Jump to content

IE Library Version (?)


Recommended Posts

Hi Guys,

I am having trouble getting a frame reference from a webpage from I have to extract information.

The following is the relevant of my code:

CODE

#include <IE.au3>

#include <File.au3>

#include <Array.au3>

;Creating Internet Explorer variables and array for file reading

$aArray = _ArrayCreate(0)

_FileReadToArray("swissprot.txt", $aArray)

;_ArrayDisplay($aArray)

$bArray = _ArrayCreate(0)

_FileReadToArray("hussny.txt", $bArray)

$url = "http://mint.bio.uniroma2.it/mint/search/searchWelcome.do?queryType=protein"

$oIE = _IECreate($url, 1, 1)

$oForm = _IEFormGetCollection ($oIE, 0)

$oInput = _IEFormElementGetObjByName($oForm, "ac")

For $i = 6 To 6;$aArray[0] Step +1

;Re-assign variables to newly visible objects

$oForm = _IEFormGetCollection ($oIE, 0)

$oInput = _IEFormElementGetObjByName($oForm, "name")

$oSubmit= _IEFormElementGetObjByName($oForm, "submit")

$splittedString = StringSplit($aArray[$i], ";")

_IEFormElementSetValue($oInput, $splittedString[1])

$oSubmit.click

;_IEFormSubmit ($oForm)

_IELoadWait($oIE)

$oFrame = _IEFrameGetCollection($oIE, 1)

;$oFrame = $oFrames[2]

$sText = _IEBodyReadText($oFrame)

MsgBox(0, "f", $sText)

;$filewrite = OpenFile("temp.txt",2)

;FileWrite($filewrite, $sText)

;FileClose($filewrite)

;GetData($bArray[$i])

Next

I am getting an error when I run this script. The error is the following which I get within the Scite editor:

C:\PROGRA~1\AutoIt3\Include\IE.au3 (2137) : ==> The requested action with this object has failed.: 
Return $o_object.document.body.innerText 
Return $o_object.document^ ERROR
->17:04:08 AutoIT3.exe ended.rc:1

I don't understand why it is giving me an error in the IE.au3 library and not in my code. Is there anything wrong which I am doing or is it some problem with the library code?

Edited by the123punch
Link to comment
Share on other sites

Please place the call _IE_VersionInfo() in your code, then can you please post ALL of the text sent to the SciTe console?

Can you please create a reproducer taht does not rely on files you did not post?

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

Please place the call _IE_VersionInfo() in your code, then can you please post ALL of the text sent to the SciTe console?

Can you please create a reproducer taht does not rely on files you did not post?

Dale

Hi,

I uploaded the files hussny.txt and swissprot.txt which my script relies on.

I also verified which version I have, as I have just downloaded the latest version of Autoit script.

What I find strange is that I tried the script from a friend's house and it worked fine but not from work.

Finally, the following is the exact complete message that I received from the SciTe controle:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\hassan\Desktop\DB-Proj\Scripts\prot_interaction.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams    
+>16:16:19 Starting AutoIt3Wrapper v.1.9.1
>Running AU3Check (1.54.7.0)  from:C:\Program Files\AutoIt3
+>16:16:20 AU3Check ended.rc:0
>Running:(3.2.4.9):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\hassan\Desktop\DB-Proj\Scripts\prot_interaction.au3"    
--> IE.au3 Warning from function _IEAttach, $_IEStatus_NoMatch
C:\PROGRA~1\AutoIt3\Include\IE.au3 (2137) : ==> The requested action with this object has failed.: 
Return $o_object.document.body.innerText 
Return $o_object.document^ ERROR
->16:16:24 AutoIT3.exe ended.rc:1
+>16:16:25 AutoIt3Wrapper Finished
>Exit code: 1    Time: 6.472

thanks.

Link to comment
Share on other sites

Some of that code looks very familiar, heh. Unless you can provide us something that reproduces the situation, which this code does not (it works fine) attaching extra files doesn't really help. Can you pinpoint what's causing the error? Narrow it down to as small of a situation as possible. What version of Internet Explorer are you using at work? At your friend's house?

Did you check to see if the variable containing the frame object is valid before trying to get it's text? If yes, what happens if you try _IEPropertyGet($oFrame, "innerText")? _IEPropertyGet($oFrame, "outerText")?

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Some of that code looks very familiar, heh. Unless you can provide us something that reproduces the situation, which this code does not (it works fine) attaching extra files doesn't really help. Can you pinpoint what's causing the error? Narrow it down to as small of a situation as possible. What version of Internet Explorer are you using at work? At your friend's house?

Did you check to see if the variable containing the frame object is valid before trying to get it's text? If yes, what happens if you try _IEPropertyGet($oFrame, "innerText")? _IEPropertyGet($oFrame, "outerText")?

At work I am using IE 7, which is the same version I used at my friend's house and same version I use at home and both these places work.

I didn't try the functions _IEPropertyGet($oFrame, "innerText") and _IEPropertyGet($oFrame, "outerText") because it is not working really. For some reason, the error seams to be in the IE library and not in my code because my code is working on other computers...

So this must be a very bizarre situation to you guys since it is working fine on your computer, and trust it is as bizarre for myself. I guess I will run that script at home for now, since it is a one-time use for now to mine data, although I might need it in the future for re-use.

If any of you guys has seen this before or knows what the problem might be, it would be great to let me know.

Thanks mikehunt for your will to help.

Link to comment
Share on other sites

Just because IE reports a COM error doesn't necessarily mean there is anything wrong with IE.au3. I have seen very few situations where any of the IE functions do anything but what they are intended to do. Some situations do require work-arounds, not every possibility can be coded for in the functions themselves. I've run into situations like yours before myself, and though I can't remember specifically what I did to resolve the issue, there are some things you can try. Did you try validating the object in your script? Another suggestion would be to put _IEErrorHandlerRegister() at the top of your script. Sometimes, although it is not a clean way to do things, it helps to allow a script to report an error, but not terminate the script. Although, that tends to be more for situations like waiting for an element to exist in a page, if that applies or not.

_IEErrorHandlerRegister("MyErrorFunc")

Func MyErrorFunc()
    ;Do nothing, continue looping the script
EndFunc
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Please post the output of _IE_VersionInfo() from a failing script (on the machine where it fails, when it fails).

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

Please post the output of _IE_VersionInfo() from a failing script (on the machine where it fails, when it fails).

Dale

Hi,

This is the output of _IE_VersionInfo() from a failing script:

[0]|V
[1]|2
[2]|2
[3]|1
[4]|20070509
[5]|V2.2-1

Some weird behaviour happens also. I decided to bring my own laptop which supposedly works. I plugged it in the same network as my work computer and I get the same error. Is it possible that it might be some kind of firewall issue since the error seems to happen on the network only???

I havent tried to run it on my laptop from a different network (like home for example) but I tried the script again today from another office , different computer and (different IP address) and it worked.

That is such a weird issue for me...

Link to comment
Share on other sites

Hi guys,

Another thing I forgot to mention is that the webpage itself from which I want to take information does not have a body tag. Thus maybe (but I am not sure that its that), maybe that fact generates the error.

I made a Page -> View Source from internet Explorer on that page and this is the source of the page:

<!--
int type: 
query: 
-->
<html>

<frameset rows="70,*"  border="0">
    <frame src="/mint/search/head.jsp" name="high">
    <frameset cols="50%,50%">
            <frame src="/mint/search/interactor.do?interactorAc=MINT-1367835&dataSet=&selectedStatus=clean" name="left">
            <frame src="/mint/search/interactors.do?interactorAc=MINT-1367835&selectedStatus=clean" name="right">
    </frameset>
</frameset>

<noframes>

</noframes>
</html>

Thanks

Link to comment
Share on other sites

If you want to work this issue, I think you need to start over. There is confusing information above.

The HTML source you show has nexted framesets and doesn't match the URL in your sample code. BTW, FrameSet pages never have a <BODY> tag.

Instead of using View Shource, I strongly recommend ConsoleWrite(_IEDocReadHTML($oIE) & @CR) so that you get the interpreted source instead of otiginal source and you cannot get confused about whether it is the correct page you are seeing. You may also want to investigate "DebugBar" (see my sig) which makes it very easy to see original source. interpreted source and the DOM tree.

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

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