ss26 Posted February 11, 2018 Share Posted February 11, 2018 On local machine some code works just fine. On Windows Server 2012 exact same code doesn't work. I wrote a demo code, but this applies to more cases where form submit event is involved and browser logs in into user's account. Demo code: #include <IE.au3> ; with 'Local' exact same result (no wonder) Global $oIE = _IECreate("http://ukrgo.com") _IELoadWait($oIE) ; maximize window Local $ie_hwnd = _IEPropertyGet($oIE, "hwnd") WinSetState($ie_hwnd, "", @SW_MAXIMIZE) ; extra safety for DOM loading etc. Sleep(5000) ; authorization form Local $oFormAuth = _IEFormGetCollection($oIE, 0) ; login and pass Local $oFieldLogin = _IEFormElementGetObjByName($oFormAuth, "login") Local $oFieldPass = _IEFormElementGetObjByName($oFormAuth, "password") _IEFormElementSetValue($oFieldLogin, "auto56216879") _IEFormElementSetValue($oFieldPass, "nlzdouByNDjx7AbhWcPL") Sleep(50) ; form submit _IEFormSubmit($oFormAuth) ; extra safety for DOM loading etc. Sleep(5000) ; click the link _IELinkClickByText($oIE, "Стройматериалы") On local machine code fires last action (click) and this element is clicked. On Windows Server exact same code doesn't produce this click for some reason. Of course, latest version of Autoit is installed inside Windows Server and is run from there, not from local machine. RDP connection is used to control server and to launch .au3 scripts there. For me it looks like Autoit looses object handle and $oIE starts pointing nowhere (or on some other thing). But even if i try to re-initialize IE object and then call click action, still nothing happens: ; all code before click action (see it above) $oIE = _IEAttach("Оголошення") _IELinkClickByText($oIE, "Стройматериалы") ; again, this action is not performed Some strange things which might matter: On server UAC is turned off completely, user is admin, Enhanced security of IE is disabled. If code is compiled as exe and run as admin same results happen. Local machine is Windows 10. Link to comment Share on other sites More sharing options...
Juvigy Posted February 12, 2018 Share Posted February 12, 2018 What are the IE versions on Server and Workstation? Do you have SCITE output from the server ? It should be a warning that _IELinkClickByText($oIE, "Стройматериалы") Failed because it didnt find the link (i guess). Link to comment Share on other sites More sharing options...
jdelaney Posted February 12, 2018 Share Posted February 12, 2018 Servers have a bunch of stuff turned off by default for security and performance reasons. I don't recall what, but I've had to turn on some things to get scripts to run on them. maybe a quick Google will do you. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
ss26 Posted February 12, 2018 Author Share Posted February 12, 2018 7 hours ago, Juvigy said: What are the IE versions on Server and Workstation? Both are IE 11. 7 hours ago, Juvigy said: Failed because it didnt find the link (i guess). No doubt: On 11.02.2018 at 11:08 AM, ss26 said: For me it looks like Autoit looses object handle and $oIE starts pointing nowhere (or on some other thing) $oIE definitely starts pointing to some other thing rather than IE instance. Question is why this happens (what is a reason). As on workstation this is perfectly working code. 5 hours ago, jdelaney said: maybe a quick Google will do you Alas, a long Google didn't help. 5 hours ago, jdelaney said: I don't recall what, but I've had to turn on some things to get scripts to run on them I'm stuck and have no ideas currently about what else can be done. Link to comment Share on other sites More sharing options...
Danp2 Posted February 12, 2018 Share Posted February 12, 2018 @ss26 Run the script in Scite and post the results from the Output window. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Juvigy Posted February 13, 2018 Share Posted February 13, 2018 14 hours ago, ss26 said: 22 hours ago, Juvigy said: Failed because it didnt find the link (i guess). No doubt: It may be that IE object point to another page or is not an abject at all. There are several reasons for the call to fail: _IELinkClickByText($oIE, "Стройматериалы") You have to run it in SCITE and see the error and warnings output. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now