Jump to content

Simple script NOT working on IE9


Recommended Posts

Hi alls,

I have this simple script :

[code]
Func MakeLogin()
    Local $o_form_login, $o_login, $o_password, $o_accedi
    ; apre IE e la pagina
    $oIE = _IECreate("http://www.casa.it/pubblica-annunci", 0, $visibile, 1, $focus)
    $o_form_login = _IEFormGetObjByName($oIE, "aspnetForm")
    ; esegue il login
    $o_login = _IEFormElementGetObjByName($o_form_login, "ctl00$MasterContentPlaceHolder$f_login_codice")
    _IEFormElementSetValue($o_login, $codice)
    $o_password = _IEFormElementGetObjByName($o_form_login, "ctl00$MasterContentPlaceHolder$f_login_password")
    _IEFormElementSetValue($o_password, $password)
    $o_accedi = _IEGetObjById($oIE, "ctl00_MasterContentPlaceHolder_lbLogin")
    _IEAction($o_accedi, "click")
    _IELoadWait($oIE)
EndFunc

'$codice' and '$password' variables are global... Anyway the values are correctly set, but it seems the 'click' action is not

performed. Such code works very well with IE8.

Thanks for any hints !

Link to comment
Share on other sites

Just a note... I did this:

Func MakeLogin()
    Local $o_form_login, $o_login, $o_password, $o_accedi

    ; apre IE e la pagina
    $oIE = _IECreate("http://www.casa.it/pubblica-annunci", 0, $visibile, 1, $focus)

    _SetIE8($oIE)

    $o_form_login = _IEFormGetObjByName($oIE, "aspnetForm")
    ; esegue il login
    $o_login = _IEFormElementGetObjByName($o_form_login, "ctl00$MasterContentPlaceHolder$f_login_codice")
    _IEFormElementSetValue($o_login, $codice)
    $o_password = _IEFormElementGetObjByName($o_form_login, "ctl00$MasterContentPlaceHolder$f_login_password")
    _IEFormElementSetValue($o_password, $password)
    $o_accedi = _IEGetObjById($oIE, "ctl00_MasterContentPlaceHolder_lbLogin")
    _IEAction($o_accedi, "click")
    _IELoadWait($oIE)
EndFunc

Func _SetIE8($_oIE)  ; by forumer100  -----  Set IE9 to IE8 Browser mode
    If RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\IEDevTools", "Pinned") Then RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\IEDevTools", "Pinned", "REG_DWORD", 0)
    $hwnd1 = _IEPropertyGet($_oIE, "hwnd")
    $titleOld = _IEPropertyGet($_oIE, "title")
    $titleNew = $titleOld & " " & Random(10000000, 99999999, 1)
    _IEPropertySet($_oIE, "title", $titleNew)
    ControlSend($hwnd1, "", "Internet Explorer_Server1", "{F12}")
    $titleF12 = $titleNew & " - F12"
    WinWait($titleF12, "", 60)
    WinSetState($titleF12, "", @SW_HIDE)
    $hwndF12 = WinGetHandle($titleF12)
    ControlSend($hwndF12, "", "ToolbarWindow321", "{alt}b8")
    Sleep(1000)
    WinClose($hwndF12)
    _IEPropertySet($_oIE, "title", $titleOld)
    WinActivate($hwnd1)
    _IEAction($hwnd1,"refresh")
EndFunc   ;==>_SetIE8

But it didn't work... it stops after _SetIE8($oIE) call. If I insert a delay or a MsgBox() , it works. Is there a way to know how big the delay must be ? Thanks again !

Link to comment
Share on other sites

Hello again,

I've a problem: on my PC (Windows-7 64bit with IE9) it works, but in another PC... the script stops on -> WinWait($titleF12, "", 60) . If I press F12 manually it works ! For some reason -> ControlSend($hwnd1, "", "Internet Explorer_Server1", "{F12}") seems to fail, but I don't know why. I'm using the English version of IE9.. maybe this text "Internet Explorer_Server1" is different in other languages ?

Thanks you !

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...