TheMaestro Posted June 7, 2013 Share Posted June 7, 2013 Hello, I am trying to use AutoIt for opening webpages and taking screenshots from it. I use following code. $url = "XXXX" _IENavigate($oIE, $url) Sleep(1000) _IELoadWait($oIE) _ScreenCapture_Capture(@ScriptDir & "\" & $sitename & "_CPU.png") Sleep(500) However, when I try to use it more then once to visit different site, I get error: --> IE.au3 V2.4-0 Error from function _IENavigate, $_IEStatus_InvalidObjectType --> IE.au3 V2.4-0 Error from function _IELoadWait, $_IEStatus_InvalidObjectType Can anybody help me with this problem? Thanks M. Link to comment Share on other sites More sharing options...
TheMaestro Posted June 7, 2013 Author Share Posted June 7, 2013 Just one remark, when I put there URL directly: _IENavigate($iOE, "google.com" I don't get any error... M. Link to comment Share on other sites More sharing options...
Danp2 Posted June 7, 2013 Share Posted June 7, 2013 You haven't provided enough information. Your best bet is to provide some example code that we can run to demonstrate the problem. Be sure to include the portion where you set / change the values of $oIE and $url. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
TheMaestro Posted June 7, 2013 Author Share Posted June 7, 2013 Hello, thank you for the reply. Here is the entire code. I just replace URL string, but the error is still there ( --> IE.au3 V2.4-0 Error from function _IENavigate, $_IEStatus_InvalidObjectType --> IE.au3 V2.4-0 Error from function _IELoadWait, $_IEStatus_InvalidObjectType ) #include <IE.au3> #include <ScreenCapture.au3> #include <array.au3> Local $oIE = _IECreate("about:blank")WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE) local $srv[3] = ["CPU","Memory_Physical_used","Memory_Virtual_used"] for $i = 0 to 2 $url = "XXX" & "&srv=" & $srv[$i] _IENavigate($oIE, $url) Sleep(500) _IELoadWait($oIE) _ScreenCapture_Capture(@ScriptDir & "\" & $srv[$i] & ".png") Sleep(500) Next Any ideas? Thank you. M. Link to comment Share on other sites More sharing options...
GMK Posted June 7, 2013 Share Posted June 7, 2013 Well, it helps to have each command on a separate line. Put a CR or LF before WinSetState. ;-) Link to comment Share on other sites More sharing options...
DaleHohm Posted June 7, 2013 Share Posted June 7, 2013 $_IEStatus_InvalidObjectType tells you that $oIE is an object variable, but it is not of the type expected. You can try adding ConsoleWrite(ObjName($oIE), & " - ", & $url & @CRLF) at the top of your loop to see what type of object it is seen as and what the last url was. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
TheMaestro Posted June 10, 2013 Author Share Posted June 10, 2013 Well, it helps to have each command on a separate line. Put a CR or LF before WinSetState. ;-) Hello, thanks for the reply. I have it on separate line, of course. Copy / paste problem:) Link to comment Share on other sites More sharing options...
TheMaestro Posted June 10, 2013 Author Share Posted June 10, 2013 $_IEStatus_InvalidObjectType tells you that $oIE is an object variable, but it is not of the type expected. You can try adding ConsoleWrite(ObjName($oIE), & " - ", & $url & @CRLF) at the top of your loop to see what type of object it is seen as and what the last url was. Dale Hello Dale, thanks for the reply. It seems, that Sleep(500) somehow destroys Name of iOE variable. Before the first sleep line ConsoleWrite(ObjName($oIE), & " - ", & $url & @CRLF) returns IWebBrowser2 - www.XXX.... but after sleep there is only - www.XXX... Any idea why this is happening? Thanks. M. Link to comment Share on other sites More sharing options...
Moderators Solution big_daddy Posted June 10, 2013 Moderators Solution Share Posted June 10, 2013 Is it possible that this relates in your case? New security in Windows Vista causes a new browser window to be created when a browser is instructed to navigate to a URL in a different security zone. This occurs as well with the initial creation and navigation initiated with _IECreate. The new window is a new browser instance and the previous browser object variable no longer points to it. There are several workarounds: 1) add #RequireAdmin to your code (this is required even if the account is part of the Administrator's Group and will propmt for credentials if necessary), 2) use _IEAttach to connect to the new browser window 3) add the target website to the Trusted Sites security zone in IE, 4) turn off "Protected Mode" in IE, or 5) disable UAC. Care must be taken to understand the implications of disabling IE security features when accessing untrusted sites. Link to comment Share on other sites More sharing options...
TheMaestro Posted June 10, 2013 Author Share Posted June 10, 2013 Is it possible that this relates in your case? AWESOME! I just added #RequireAdmin and it works Thanks a lot! Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted June 10, 2013 Moderators Share Posted June 10, 2013 You're welcome. Glad to see my troubleshooting skills are not too rusty! P.S. - The "Mark Solved" is a cool new feature. Link to comment Share on other sites More sharing options...
silver64 Posted January 13, 2015 Share Posted January 13, 2015 Is it possible that this relates in your case New security in Windows Vista causes a new browser window to be created when a browser is instructed to navigate to a URL in a different security zone. This occurs as well with the initial creation and navigation initiated with _IECreate. The new window is a new browser instance and the previous browser object variable no longer points to it. There are several workarounds: 1) add #RequireAdmin to your code (this is required even if the account is part of the Administrator's Group and will propmt for credentials if necessary), 2) use _IEAttach to connect to the new browser window 3) add the target website to the Trusted Sites security zone in IE, 4) turn off "Protected Mode" in IE, or 5) disable UAC. Care must be taken to understand the implications of disabling IE security features when accessing untrusted sites. Hi guys, I know this is an old post, but I have the same problem. The workarounds mentioned does not work for me. This is my code: $oSite = _IECreate('google.com') _IENavigate($oSite,'facebook.com') if @error Then MsgBox(16,"Error","Error Code: " & @error) EndIf _IENavigate($oSite,'yahoo.com') if @error Then MsgBox(16,"Error","Error Code: " & @error) EndIf _IENavigate($oSite,'gmail.com') if @error Then MsgBox(16,"Error","Error Code: " & @error) EndIf Errors: >Running AU3Check (3.3.12.0) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\SilverComputer\Desktop\ietest\test2.au3 +>00:01:59 AU3Check ended.rc:0 >Running:(3.3.12.0):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\SilverComputer\Desktop\ietest\test2.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop --> IE.au3 T3.0-1 Warning from function _IELoadWait, $_IESTATUS_LoadWaitTimeout --> IE.au3 T3.0-1 Error from function _IENavigate, $_IESTATUS_COMError (-2147352567) My IE version: IE object gets lost after a number of IE navigations. I have already added #requireadmin, added all of the sites to the Trust Sites in IE options, and protection mode is disabled. Link to comment Share on other sites More sharing options...
silver64 Posted January 18, 2015 Share Posted January 18, 2015 Oh well, I had to move back to IE9 to fix this problem. 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