Sign in to follow this  
Followers 0
lmid

IE automation ObjName- requested action has failed

19 posts in this topic

Hi, I'm new to AutoIT. I was playing around with DaleHohm's Internet Explorer Automation UDF library, and I pulled out a few lines that I am having problems with.

msgbox (1,"",@autoitversion)
Dim $o_Shell = ObjCreate("Shell.Application")
    Dim $o_ShellWindows = $o_Shell.Windows (); collection of all ShellWindows (IE and File Explorer)
    For $o_window In $o_ShellWindows
        If (ObjName($o_window.document) = "DispHTMLDocument") Then

I am running version 3.1.66. This works on the computer I made it on but all other computers (sometimes) get the error:

If (^Error

Error: The requestion action with this object has failed.

I installed autoIT, starting with V2, and then V3, beta 65, then 66 on each computer but it didn't seem to help.

Can anyone help me?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I assume you only get this error when you use the _IEAttach() function?

This has been a troublesome piece of code because of the wide variety of things that end up in the Shell.Application collection -- and these different objects have different properties.

I thought that I had solved this by checking for the ObjName of the .document because it appeared that all shell objects had a document. It appears that you may have something unique however.

Please add the following line of code after the For line and before the If ( line:

ConsoleWrite(ObjName($o_window) & @CR)

This assumes you are running this inde SciTe so that you can capture the ConsoleWrite output. Let me know what is output just prior to the failure. Also try closing different windows and applications to see if you can find one that is tied to the problem.

Dale

Edit: added missing ')' in debug line

Hi, I'm new to AutoIT.  I was playing around with DaleHohm's  Internet Explorer Automation UDF library, and I pulled out a few lines that I am having problems with.

msgbox (1,"",@autoitversion)
Dim $o_Shell = ObjCreate("Shell.Application")
    Dim $o_ShellWindows = $o_Shell.Windows (); collection of all ShellWindows (IE and File Explorer)
    For $o_window In $o_ShellWindows
        If (ObjName($o_window.document) = "DispHTMLDocument") Then

I am running version 3.1.66.  This works on the computer I made it on but all other computers (sometimes) get the error:

If (^Error

Error: The requestion action with this object has failed.

I installed autoIT, starting with V2, and then V3, beta 65, then 66 on each computer but it didn't seem to help.

Can anyone help me?

<{POST_SNAPBACK}>

Edited by DaleHohm

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

Share this post


Link to post
Share on other sites

Thank you so much for your help.

Yes the code is from the _IEAttach function.

I am not running inde SciTe. I used a message box. The only things that popped up (including right before it broke) was IEWebBrowser2.

I assume you only get this error when you use the _IEAttach() function?

This has been a troublesome piece of code because of the wide variety of things that end up in the Shell.Application collection -- and these different objects have different properties.

I thought that I had solved this by checking for the ObjName of the .document because it appeared that all shell objects had a document.  It appears that you may have something unique however.

Please add the following line of code after the For line and before the If ( line:

ConsoleWrite(ObjName($o_window) & @CR)

This assumes you are running this inde SciTe so that you can capture the ConsoleWrite output.  Let me know what is output just prior to the failure.  Also try closing different windows and applications to see if you can find one that is tied to the problem.

Dale

Edit: added missing ')' in debug line

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites

Thank you so much for your help.

Yes the code is from the _IEAttach function.

I am not running inde SciTe.  I used a message box.  The only things that popped up (including right before it broke) was IEWebBrowser2.

<{POST_SNAPBACK}>

Hmmm... then this doesn't make sense to me. Please try the other piece of what I asked and close different application windows and retest to narrow this down. Apps that have caused trouble in the past are IE (displaying an FTP site for example), Outlook (and a modified pageview or OutlookToday) of file explorer windows.

Please see if you can find the trigger and let me know.

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

Share this post


Link to post
Share on other sites

Hi. I've been running into the same problem.

I ran the console output and I found that the loop ...

For $o_window In $o_ShellWindows

               ; == DEBUG BEGINS HERE ==
                $dbg1 = ObjName($o_window)
                $dbg2 = ObjName($o_window.document)
                ConsoleWrite(""&$dbg1&"."&$dbg2&@CR)
               ; == DEBUG ENDS HERE ==     

        If (ObjName($o_window.document) == "DispHTMLDocument") Then
        -------------------------------------------
        EndIf
    Next

Is infinite. It seems to me like the system keeps looping through the windows forever until either AutoIt catches the infinite aspect of the loop and spills the error, or (if the console output debug is uncommented, notice my modified debug) keeps typing its output forever, which is ...

IWebBrowser2.DispHTMLDocument

...

IWebBrowser2.DispHTMLDocument

Share this post


Link to post
Share on other sites

Hi. I've been running into the same problem.

I ran the console output and I found that the loop ...

For $o_window In $o_ShellWindows

              ; == DEBUG BEGINS HERE ==
                $dbg1 = ObjName($o_window)
                $dbg2 = ObjName($o_window.document)
                ConsoleWrite(""&$dbg1&"."&$dbg2&@CR)
              ; == DEBUG ENDS HERE ==      

        If (ObjName($o_window.document) == "DispHTMLDocument") Then
        -------------------------------------------
        EndIf
    Next

Is infinite. It seems to me like the system keeps looping through the windows forever until either AutoIt catches the infinite aspect of the loop and spills the error, or (if the console output debug is uncommented, notice my modified debug) keeps typing its output forever, which is ...

IWebBrowser2.DispHTMLDocument

...

IWebBrowser2.DispHTMLDocument

No, $o_ShellWindows is a finite collection. It runs through the loop once for each window in the collection and then moves on.

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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Yup. You're right. I was just having "one of those moments" :lmao:

I just found out that I was sort of accidentally "load testing" your _IEAttach function as a component of a wait loop.

Anyway, I got around that problem by just waiting for the page to load first before checking the Title text (much to my chagrin; I'm building a regression testing script for my company's web app so speed is nice to have)

===========

Now onto new problems. This one's been jumping in and out from time to time...

C:\Program Files\AutoIt3\beta\Include\IE.au3 (1247) : ==> The requested action with this object has failed.:

While ($o_object.document.readyState <> "complete") and ($o_object.document.readyState <> 4)

While ($o_object.document^ ERROR

That's the 4th line of _IELoadWait, which is being called by an _IENavigate call to www.cnn.com (I'm testing a redirect to some internal login page). The web page loads and/or redirects as it should, and load up to "done" so I'm not sure why these actions fail. Any thoughts?

By the by, just thought I'd say THANKS! This addition to AutoIt makes this wicked powerful.

Edited by QA Stooge

Share this post


Link to post
Share on other sites

Now onto new problems. This one's been jumping in and out from time to time...

That's the 4th line of _IELoadWait, which is being called by an _IENavigate call to www.cnn.com (I'm testing a redirect to some internal login page). The web page loads and/or redirects as it should, and load up to "done" so I'm not sure why these actions fail. Any thoughts?

By the by, just thought I'd say THANKS! This addition to AutoIt makes this wicked powerful.

Please explain the "redirect"

This is one of the most likely causes of the error in this spot. The scenario would be that we enter the _IELoadWait routine and get a reference to the current document and loop waiting for it to completely load. Before the load can finish however, a redirect occurs to a new page. When a redirect occurs, the document object we are checking the ready state on is no longer valid and is replaced with a new one that the function is oblivious to. The reference to the invalid document produces the error.

Dale

re: THANKS! - You're welcome! :lmao:


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

Share this post


Link to post
Share on other sites

The way the redirect works is as follows:

When a user attempts to navigate to any web page, the local server checks to see if this machine is logged in. If not, the browser instead gets redirected to our login page to enter information. If they are already logged in, they surf normally. So in other words...

User trying to surf to some URL...

Case#1: Machine not logged into network.

Result: Instead of requested webpage, gets a login page to enter information

Case#2: Machine logged into network.

Result: Reaches requested URL normally.

The problem actually doesn't happen with the redirect itself. The problem occurs on the "logout" test.

There's a particular URL to manually log out (http://4.2.2.1/Logout) where they get a page with only a confirmation button ("are you sure you wanna log out?"). When I'm using _IEAttach to test that they go to the right page after confirmation, I get that little hiccup. Keep in mind I am setting the flag to properly wait for the resulting page to load.

Hope that helps.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

One potential way to address this is to check the readyState of the browser object instead of the embedded document. This is a good general solution if the readyState of all child objects of the browser bubble up, but I have not been able to confirm it one way or the other (MSDN is ambiguous here).

You could try this by modifying your _IELoadWait() to replace this line:

While ($o_object.document.readyState <> "complete") and ($o_object.document.readyState <> 4)

with this one:

While ($o_object.readyState <> "complete") and ($o_object.readyState <> 4)

Dale

Edited by DaleHohm

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

Share this post


Link to post
Share on other sites

That worked like a charm!

... I'm looking for a "we're not worthy" smily but can't find it.

Thanks a truckload!

Share this post


Link to post
Share on other sites

That worked like a charm!

... I'm looking for a "we're not worthy" smily but can't find it.

Thanks a truckload!

Glad to hear it. I've been evaluating this as a change for the next release, so please let me know if you have any trouble crop up as a result (I'm particularly worried about things like FrameSet pages reporting they are complete before they actually are).

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

Share this post


Link to post
Share on other sites

Glad to hear it. I've been evaluating this as a change for the next release, so please let me know if you have any trouble crop up as a result (I'm particularly worried about things like FrameSet pages reporting they are complete before they actually are).

Dale

Actually that's exactly what's happening on my logout test. The modified IE script says that the page is "ready" when a form on the previous page is submitted, even before this next page loads. As a result, tests that check for HTML content after submitting a form always fail (because it's tesing the previous page). I'm dreading the notion of putting in a constant sleep or wait state for the page to load.

Share this post


Link to post
Share on other sites

Actually that's exactly what's happening on my logout test. The modified IE script says that the page is "ready" when a form on the previous page is submitted, even before this next page loads. As a result, tests that check for HTML content after submitting a form always fail (because it's tesing the previous page). I'm dreading the notion of putting in a constant sleep or wait state for the page to load.

So you're having this trouble now with the modified code right? Thanks.

This gives me another idea that has been staring me in the face and that should work consistently. We'll change the logic so that it repeatedly checks the readyState of the current document instead of remembering what it was examining when the loop started.

In _IELoadWait(), please replace this code:

While ($o_object.document.readyState <> "complete") and ($o_object.document.readyState <> 4)
            Sleep(100)
        WEnd

With this code:

local $fReady = False
        While Not $fReady
            If ($o_object.document.readyState = "complete") or ($o_object.document.readyState = 4) Then $fReady = True
            Sleep(100)
        WEnd

Let me know your results.

Thanks,

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

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Didn't see any real difference.

Is there a way to determine the status of the frameset inside?

I think what's happening is the submit button isn't changing the URL directly, but running some php that only changes the embedded content. Yet it still takes enough time that my test comes to a "failed" conclusion before the change occurs.

Also, another problem I'm having is when I'm trying to use the _IEFormElementGetTypeByIndex function. The page I'm running this test on has 2 buttons with the name "submit" (which is silly, I know), but one is a of input type "submit" and another is of input type "button". I want to differentiate between the two items, so I'm doing this.

For $iCount = 0 to $fElements step 1
        $eType = _IEFormElementGetTypeByIndex($formInQuestion, $iCount)
        ConsoleWrite("Type of element #"&$iCount&" is '"&$eType&"'."&@CR)
        if $eType == "submit" then
            $iSub = $iCount
        EndIf
        $iCount = $iCount + 1
    Next

Then I take the "$iSub" value and I know which item (by index) to click.

Problem is that console output up there says that the item's type whose index should be that of the submit button is "0" ... which makes no sense.

==EDIT==

Nevermind. I'm dumb and incremented the loop twice

Edited by QA Stooge

Share this post


Link to post
Share on other sites

Didn't see any real difference.

Sorry, I don't follow what is happening on your page. You'll need to provide more detail.

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

Share this post


Link to post
Share on other sites

Well I found out what it was all along.

in th Wait function mentioned before,

$o_object.document.readyState = 4

should be

$o_object.document.readyState == 4

Fixed it. Now everything works beautifully!

... tentatively speaking, that is :lmao:

Share this post


Link to post
Share on other sites

Well I found out what it was all along.

in th Wait function mentioned before,

$o_object.document.readyState = 4

should be

$o_object.document.readyState == 4

Fixed it. Now everything works beautifully!

... tentatively speaking, that is :)

Well, I've tried just about everything, and I can't seem to get this to work. I might mention that the web page that I'm interfacing with uses frames. I've tried sending the object for the frame as a variable into the _IELoadWait function; I've tried sending the object for the browser, and it seems that nothing works all of the time. Does anyone have any ideas as to how to make the _IELoadWait work correctly all of the time? It seems that at times it works for me, and at times it doesn't. There doesn't seem to be any rhyme or reason as to why it's not working. Can someone please help me? This is the very last step to get my script working, and it's driving me nuts! :-P

Share this post


Link to post
Share on other sites

Well, I've tried just about everything, and I can't seem to get this to work. I might mention that the web page that I'm interfacing with uses frames. I've tried sending the object for the frame as a variable into the _IELoadWait function; I've tried sending the object for the browser, and it seems that nothing works all of the time. Does anyone have any ideas as to how to make the _IELoadWait work correctly all of the time? It seems that at times it works for me, and at times it doesn't. There doesn't seem to be any rhyme or reason as to why it's not working. Can someone please help me? This is the very last step to get my script working, and it's driving me nuts! :-P

I wouldn't suggest jumping into this thread with your issue... there are several issues discussed in this thread already and your is not guaranteed to be the same as any of them.

Regarding the "=" and "==" difference noted above, someone would have to educate me on that. My understanding is that in AutoIt, unlike some other languages, the difference between the two is case sensitivity and I am using the one I want to use.

There is an obscure timing issue mentioned in this thread and I have posted different test code at the end of the IE.au3 post taht you are welcome to test and provide me with feedback. I have finally been able to reproduce a flavor of this issue and am hopeful that the new code will provide a permanent fix.

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0