Sign in to follow this  
Followers 0
funnycool

_IE functions: Unable get links or text from Frame

7 posts in this topic

Hi All,

I am trying to automate some navigation via autoit.

The site i am opening is http://empower.polaris.co.in/

It has Frameset and inside it only one frame with name as M

After IECreate function. I am retrieving the Frame using IEFrameGetObjByName. @ERROR shows 0 meaning it has got only one frame.

I am using oFrame reference variable which is M frame to retrieve the Links in that HTML, but it is returning 0 links

I am also trying to click the link "Adrenalin" using IELinkClickByText function, but it is returns as 0 and @ERROR has 7.

Following is the code

#include <IE.au3>
$oIE = _IECreate ("empower.polaris.co.in")
$oFrame = _IEFrameGetObjByName ($oIE, "M")
MsgBox(1,"Test","_IEFrameGetObjByName : " & @ERROR )
$oLinks = _IELinkGetCollection ($oFrame)
MsgBox(1,"Test","_IELinkGetCollection : " & @ERROR )
$iNumLinks = @extended
MsgBox(0, "Link Info", $iNumLinks & " links found")
For $oLink In $oLinks
    MsgBox(0, "Link Info", $oLink.href)
Next
$res = _IELinkClickByText ($oFrame, "Adrenalin")
MsgBox(1,"Test",$res & " " & @ERROR )

POINT TO NOTE: If i view the source code of the above home page. it shows the Frames src as /new+arch/empowersso.nsf/VitalLoad?OpenForm

But, if i use the following source to retrieve the URL

MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "locationurl"))

It loads /new+arch/empowersso.nsf/loginhomepage?openframeset

Is there anything wrong i did? why does URL show different from source code and using _IEPropertyGet method. Is this done purposefully to avoid automated scripts?

Waiting for suggestions.

Do Open the website that i mentioned on the top to get better idea.

Share this post


Link to post
Share on other sites



Suggest you use DebugBar.

The Frame M contains another Frameset:

<FRAMESET frameSpacing=0 border=0 cols=155,1* frameBorder=0><FRAME noResize src="/new%20arch/empowersso.nsf/SessNav?OpenForm" frameBorder=0 name=TBand scrolling=no><FRAME noResize src="/new%20arch/empowersso.nsf/NewLogin?OpenForm" frameBorder=0 name=BBand></FRAMESET>

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

Hello everyone. Longtime reader/lurker, and due to the wealth of information on this site have never needed to make a post until now. To the amazing AutoIt community: thank you!

I'm having a similar problem as the OP with IE.au3 and frames. I'm working with the following frameset:

<frameset name="top" rows="60,*" border="0" frameSpacing="0" frameBorder="0" > 
        <frame frameborder=0 border=0 frameSpacing=0 src="TopMenu.aspx" name="top" noresize> 
        <FRAMESET cols="180,*" frameSpacing="0" frameBorder="0" > 
            <frame name="menubar" src="MainMenu.aspx" scrolling="auto" noresize> 
            
            <frame name="body" src="StartPage.aspx" frameborder="1" marginwidth="5" noresize> 
            
        </FRAMESET> 
        <noframes> 
            <p>This page requires frames, but your browser does not support them.</p> 
        </noframes> 
    </frameset>
As you can see I have a frameset within a frameset. Perhaps that's the problem... does IE.au3 not support this?

Here are some code snippets I've tested and the outcome:

$oIE = _IECreate ("http://siteurl/")
$oMenuFrame = _IEFrameGetObjByName ($oIE , "menubar")
MsgBox(0, "test", "success")
Result: The message box never displays. No errors in the SciTE console. Script just stops.

$oIE = _IECreate ("http://siteurl/")
$oTopFrame = _IEFrameGetObjByName ($oIE, "top")
$oMenuFrame = _IEFrameGetObjByName ($oTopFrame , "menubar")
MsgBox(0, "test", "success")
Result: The message box never displays. No errors in the SciTE console. Script just stops.

$oIE = _IECreate ("http://siteurl/")
$oFrames = _IEFrameGetCollection($oIE)
MsgBox(0, "test", @extended)
Result: The message box does display, with the number 3. So it is detecting the frames to some extent.

$oIE = _IECreate ("http://siteurl/")
$oFrames = _IEFrameGetCollection($oIE)
$iNumFrames = @extended
For $i = 0 to ($iNumFrames - 1) ;this is the example loop from the help file
    $oFrame = _IEFrameGetCollection ($oIE, $i)
    MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "locationurl"))
Next
MsgBox(0, "test", "complete")
Result: Only the "complete" message box displays. The loop doesn't seem to do anything even though I know iNumFrames is 3.

Any assistance or guidance would be greatly appreciated.

Thanks!

Share this post


Link to post
Share on other sites

Suggest you use DebugBar.

The Frame M contains another Frameset:

<FRAMESET frameSpacing=0 border=0 cols=155,1* frameBorder=0><FRAME noResize src="/new%20arch/empowersso.nsf/SessNav?OpenForm" frameBorder=0 name=TBand scrolling=no><FRAME noResize src="/new%20arch/empowersso.nsf/NewLogin?OpenForm" frameBorder=0 name=BBand></FRAMESET>

Dale

Dale,

Thank you very much. Can i access TBand and BBand frames without actually requesting/opening that URL directly. But just by opening http://empower.polaris.co.in/ (which shows M frameset, but opens TBand and BBand frames internally)?

Share this post


Link to post
Share on other sites

If I understand you correctly, yes. Give it a try.

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

Dale,

Thank you very much. Can i access TBand and BBand frames without actually requesting/opening that URL directly. But just by opening http://empower.polaris.co.in/ (which shows M frameset, but opens TBand and BBand frames internally)?

Dale,

Thank you very much. Can i access TBand and BBand frames without actually requesting/opening that URL directly. But just by opening http://empower.polaris.co.in/ (which shows M frameset, but opens TBand and BBand frames internally)?

I am now facing a strange issue. All these days i tested the above code from the client's environment(for which i work). The script was able to access M Frame and then TBand frame and was able to click the left side link Adrenalin.

The website is http://empower.polaris.co.in/

I copied the same script in Polaris network(my company). On executing from Scieditor with _IEErrorHandlerRegister() on the the top of the script , the script fails and gives the following error:

----> $IEComErrorScriptline = 767

----> $IEComErrorNumberHex = 80020009

----> $IEComErrorNumber = -2147352567

----> $IEComErrorWinDescription = Access is denied.

----> $IEComErrorDescription = Access is denied.

----> $IEComErrorSource =

----> $IEComErrorHelpFile = C:\WINDOWS\system32\mshtml.hlp

----> $IEComErrorHelpContext = 0

----> $IEComErrorLastDllError = 0

It means cross-domain issue. But, as you have also seen few days back, that the frames inside frameset are part of same site and it works on the client network. but, when run on Polaris network where actually empower.polaris.co.in is hosted gives the above error.

Any idea what could be the reason?

Share this post


Link to post
Share on other sites

I don't have a pat answer... check my sig for a link to a detailed CrossFrame Scripting discussion. The rules are not as straight forward and you might believe.

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