Jump to content

Please help me to code web auto login


Recommended Posts

I want to write a code automatically login to the web. But I have problems because that site.

Web Code as follows:

"<div class="left">

<div class="box_dangnhap">

<div>

<img src="https://ebank.vtc.vn/media/resources/images/box1_top.gif" alt=""></div>

<div class="text1">

Đăng nhập</div>

<div class="pad_form">

<input name="ctl00$txtUserName" id="ctl00_txtUserName" tabindex="1" style="color: Gray;" type="text">

<input name="ctl00$TextBoxWatermarkExtender1_ClientState" id="ctl00_TextBoxWatermarkExtender1_ClientState" type="hidden">

<span id="ctl00_RequiredFieldValidatorUserName" style="color: Red; display: none;"></span>

<input name="ctl00$ValidatorCalloutExtender2_ClientState" id="ctl00_ValidatorCalloutExtender2_ClientState" type="hidden">

</div>

<div class="pad_form">

<input name="ctl00$txtPassword" id="ctl00_txtPassword" tabindex="2" class="keyboardInput" style="color: Gray;" type="password"><img title="Bàn phím ảo" class="keyboardInputInitiator" alt="Keyboard interface" src="https://ebank.vtc.vn/media/resources/images/icon_keyboard.gif">

<input name="ctl00$TextBoxWatermarkExtender2_ClientState" id="ctl00_TextBoxWatermarkExtender2_ClientState" type="hidden">

<span id="ctl00_RequiredFieldValidatorPassword" style="color: Red; display: none;"></span>

<input name="ctl00$ValidatorCalloutExtender4_ClientState" id="ctl00_ValidatorCalloutExtender4_ClientState" type="hidden">

</div>

"

My code:

"#include <IE.au3>
#include <file.au3>

; Open IE and login
$oIE = _IECreate ("http://ebank.vtc.vn", 1, 1, 0)
_IELoadWait ($oIE)
$oForm = _IEFormGetObjByName ($oIE, "box_dangnhap")

$aUserName = "thegrudge2"
$aPassword = "tuananh"
$o1 = _IEFormElementGetObjByName ($oForm, "ctl00$txtUsername") 
_IEFormElementSetValue ($o1, $aUserName)

$o2 = _IEFormElementGetObjByName ($oForm, "ctl00$txtPassword")
_IEFormElementSetValue ($o2, $aPassword)
Sleep(3000)

$oSubmit = _IEGetObjByName ($oIE, "ctl00_btnLogin")
_IEAction ($oSubmit, "click")
_IELoadWait ($oIE)"

It can not because the automatic login type = hidden (red letters I wrote above)

Please help me write the code for this web log .Thanks

Link to comment
Share on other sites

Look at the scripts on that page. Something is probably reading the content of the visible inputs, doing some sanity checks, and then copying it to the hidden input fields.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Look at the scripts on that page. Something is probably reading the content of the visible inputs, doing some sanity checks, and then copying it to the hidden input fields.

;)

I do not know that much. I'm learning AutoIt. Can you or someone tell me more detail it? Anyway thank you very much .
Link to comment
Share on other sites

Use a DOM inspector like DebugBar for IE, or FireBug for Firefox.

Look for scripts on the page and what triggers them. One of them probably copies (maybe with encryption) from the visible inputs to the hidden ones. The required script(s) need to be triggered as they normally would be by manual use of the page.

That information may not help you much until you learn a little about how the IE Document Object Model (DOM) works, which is what the _IE* functions in Dale's IE.au3 UDF are based on.

Put your boots on and start climbing the learning curve!

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...