Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automating login to the site 1

Status
Not open for further replies.

PavelGur

Programmer
Joined
Sep 21, 2001
Messages
75
I'm trying to automate login to one of the sites I'm involved in. I found the example here in one of the previous threats and followed the advices.
First I saved the login page and entered values of id and password. Then I added after login form the following code:

<script type="text/javascript">
document.getElementById("LoginForm").submit();
</script>

Now when I load the page from my C drive it appears with ID and Password on the screen. However the page is not submitted and "log in" button is disabled. Even if I click on it or press Enter key nothing happens.

I looked in the page code and found the following related to the log in button:

<TD vAlign=bottom align=left><INPUT language=javascript class=submitbutton id=btnLogin onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " type=submit value="Log In" name=btnLogin></TD></TR></TBODY></TABLE></TD>

There is Page_ClientValidate function in the directory subordinate to the directory where page is saved. It looks like this:
function Page_ClientValidate() {
var i;
for (i = 0; i < Page_Validators.length; i++) {
ValidatorValidate(Page_Validators);
}
ValidatorUpdateIsValid();
ValidationSummaryOnSubmit();
Page_BlockSubmit = !Page_IsValid;
return Page_IsValid;
}
This function calls few other functions that are there as well.
I'm not sure what I should do to force page to be submitted. Should I try to disable the validatin functions?
Thanks in advance, PavelGur.
 
Should I try to disable the validatin functions?

Why don't you tell us - these are your requirements, after all. If you need validation, then debug them, not remove them. If you don't need validation, then remove them.

If you don't know your own requirements, how is any solution we give you going to be more than guesswork as to whether it is what you really need or not?

That aside, it's going to be pretty much impossible to debug the problem with the code you've given - we have no idea what the validators are doing, or what is being validated.

Hope this helps,
Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Sorry, I did not explain clear enough what I'm trying to do. The Web site I mentioned is not my site but the site of the interactive brocker I use for trading. The URL is I want my program to load the page with my ID and Password and submit it to the broker. I do not think there is anything illegal in doing it. Appatently Cyber Trader does not want me to do it and therefore put a lot of validation functions in it.

I do not want to validate anything. However I'm willing to do anything necessary to satisfy their validation.

So far my attempts to bypass their validations did not succeed.
Thanks, Pavel.
 
Hi All,

I'm new in front end programming, my experience is in middleware. However I've started to work with Javascript embedded in HTML pages. I'd appreciate so much if someone can send me a login page example invoking a servelt, specially, what I have to do after the submit, for example, to load a second page depending of the validation done by the servlet.

Regards,

J.C.
 
PavelGur,

This might work for you...
Code:
<form method="post" action="[URL unfurl="true"]https://www.cybertrader.com/Login.aspx">[/URL]
<input name="tbxUserName" type="text" id="tbxUserName" />
<input name="tbxPWD" type="password" id="tbxPWD" />
<select name="selMode" id="selMode">
	<option value="1">Live</option>
	<option value="0">Demo</option>
</select>
<input type="submit" name="btnLogin" value="Log On" />
</form>
But if the site is checking, then it will be able to determine that you are not logging on using their form (and may redirect you to their login page when you try).

Let us know how you go,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Thank you BabyJeffy!
I actually resolved my original problem. I think I did not state clearly what I wanted to do. I needed programmatically to login to my broker’s site and get real time data. I did it in VB and it works perfectly well. Now I want to capture news from the same site that manually being done by clicking on link line. However the line does not have id or name. So I’m not sure how I can imitate the click.
PavelGur.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top