Jump to content

Recommended Posts

Posted

I am trying to create a script in order to automatically login to a webpage. The code looks like this:

#include <IE.au3>

$oIE = _IECreate('https://www.randompage.com')

_IELoadWait($oIE)

$user = _IEGetObjById ($oIE, 'login-name')
$pass = _IEGetObjById ($oIE, 'PortalDesktop_Authenticationlogin-password')

_IEPropertySet ($user, 'innertext', 'my_user')
_IEPropertySet ($pass, 'innertext', 'my_pass')

The issue I have is that for the password input field the script is working and "my_pass" is sent correctly to the web browser, but "my_user" input field is not populated. I assume this is because in HTML the field looks like this:

<input name="IDToken1" tabindex="1" class="med valid" id="login-name" type="text" autocomplete="off">

In my opinion, the autocomplete="off" in HTML is blocking the string sent by _IEPropertySet. Am I right? How can I solve this?

Thank you.

Posted
54 minutes ago, Danp2 said:

Use _IEFormElementSetValue instead of _IEPropertySet. 

Still doesn't work :( . Same result!

Posted

Is there any possibility to eliminate the outocomplete="off" from the HTML code? I had a look at the forum topics and found a similar issue (which is not solved since 2012). The guy tried to use this function:

StringRegExpReplace

I also tried to use it but without success. Maybe I don't get the function's syntax correct so if someone thinks this could help please let me know. 

My current code is (webpage included as Danp2 asked):

 

#include <IE.au3>

$oIE = _IECreate('https://www.vodafone.ro/myvodafone/index.htm')

_IELoadWait($oIE)

$user = _IEGetObjById($oIE, 'login-name')
$pass = _IEGetObjById($oIE, 'PortalDesktop_Authenticationlogin-password')

_IEPropertySet($user, 'innertext', 'my_user')
_IEPropertySet($pass, 'innertext', 'my_pass')

Scite output window:

Quote

>"C:\xxxxx\xxx\AutoIt3\SciTE\..\AutoIt3.exe" "C:\xxxxxx\xxxxx\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\xxx\xxxxx\AutoIt3\Saved_work\Test_5.au3" /UserParams    
+>15:44:09 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0   Keyboard:00020409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64  Environment(Language:0409)  CodePage:0  utf8.auto.check:4
+>         SciTEDir => C:\xxxxx\xxxxxx\AutoIt3\SciTE   UserDir => C:\xxxx\xxxxx\xxxxx\xxxx\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\xxxx\xxxx\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.3)  from:C:\xxxxx\xxxx\AutoIt3  input:C:\xxxxx\xxxxxx\AutoIt3\Saved_work\Test_5.au3
+>15:44:09 AU3Check ended.rc:0
>Running:(3.3.14.3):C:\xxxxxx\xxxxx\AutoIt3\autoit3.exe "C:\xxxxxx\xxxxxx\AutoIt3\Saved_work\Test_5.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
+>15:44:14 AutoIt3.exe ended.rc:0
+>15:44:14 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 6.391
 

 

Thank you!

Posted

It's working, just not as you intended because there are multiple input elements with the same name. Here's how to fix it by using to proper _IEForm commands --

#include <IE.au3>

$oIE = _IECreate('https://www.vodafone.ro/myvodafone/index.htm')

$oForm = _IEFormGetObjByName($oIE, "loginFormPortalDesktop_Authentication")

$user = _IEFormElementGetObjByName($oForm, 'IDToken1')
$pass = _IEFormElementGetObjByName($oForm, 'IDToken2a')

_IEFormElementSetValue ($user, 'my_user')
_IEFormElementSetValue ($pass, 'my_pass')

 

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
  • Recently Browsing   0 members

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