misjdd Posted October 16, 2008 Posted October 16, 2008 OK. I have read several forums and posts and I am still a little short on knowledge for how to do this. I want to do an _IELinkClickByText on a link inside of an Iframe whose source is on a different domain. From what I understand, I can open the source of the Iframe in a new window (this works OK) to avoid the DOM security issue of cross domain scripting. However, when the source is opened, I still get access denied errors. I am not going to bother posting my code because it is certainly not even close to correct, but can someone give me an example of code for the following scenario? The main page has 3 frames... FRAME2 is the one with the content i want to access FRAME2 has a form on it... lets call it FORM1 Inside that form is an iframe whose source is on a different domain ... lets call the iframe IFRAME1 The links that I want to access are inside of the Iframe ... LINK1 LINK2 LINK3 So basically I am asking for code or pseudo code to access those links, assuming that there is not some inherited security issue. Thanks in advance. I am VERY new to the IE.au3 code so it is still foggy in my head. Everyone hates newbs, I know
PsaltyDS Posted October 16, 2008 Posted October 16, 2008 OK. I have read several forums and posts and I am still a little short on knowledge for how to do this. I want to do an _IELinkClickByText on a link inside of an Iframe whose source is on a different domain. From what I understand, I can open the source of the Iframe in a new window (this works OK) to avoid the DOM security issue of cross domain scripting. However, when the source is opened, I still get access denied errors. I am not going to bother posting my code because it is certainly not even close to correct, but can someone give me an example of code for the following scenario?The main page has 3 frames... FRAME2 is the one with the content i want to accessFRAME2 has a form on it... lets call it FORM1Inside that form is an iframe whose source is on a different domain ... lets call the iframe IFRAME1The links that I want to access are inside of the Iframe ... LINK1 LINK2 LINK3So basically I am asking for code or pseudo code to access those links, assuming that there is not some inherited security issue.Thanks in advance. I am VERY new to the IE.au3 code so it is still foggy in my head. Everyone hates newbs, I know Cross-domain scripting limitations are built in to IE. You can get the source URL of the iFrame, and then try to open that in its own instance of IE or a tab (if IE7). Some sites don't allow that page to be loaded directly, in which case you're out of luck.You won't know until you try. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
misjdd Posted October 19, 2008 Author Posted October 19, 2008 Cross-domain scripting limitations are built in to IE. You can get the source URL of the iFrame, and then try to open that in its own instance of IE or a tab (if IE7). Some sites don't allow that page to be loaded directly, in which case you're out of luck.You won't know until you try. OK... I did that and it works! But I still don't see how to "click" the control I am trying to drill to... here is the structure according to DebugBar:<document> <html> <body> <DIV class=mainFrame id=mainFrame> <DIV class=tabContainer> <DIV id=tabsDiv> <table> <tbody> <tr> <td> <SPAN class=selectedTab style="CURSOR: pointer" jQuery1224424411281="14">Main</SPAN>Now... here is a snippet of my code:$mainFrame = _IEGetObjById($oFrame,"mainFrame")$Tabs = _IEGetObjById($mainFrame,"tabsDiv")When I do the _IETableGetCollection on the $Tabs ... It sees the table... but how can I simulate a click onto the Span item?Thanks in advance!
DaleHohm Posted October 19, 2008 Posted October 19, 2008 Hint: _IETagnameGetCollection( , "span", index) and _IEAction( , "click") 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
misjdd Posted October 20, 2008 Author Posted October 20, 2008 Hint: _IETagnameGetCollection( , "span", index) and _IEAction( , "click")OK that worked! I found that I do not need to drill down into the mainframe DIV or the tabsDiv DIV items either... I do have another challenge and that is that the other location I need to click is inside of the following structure:<DIV><DIV><DIV><TABLE><TBODY><TR><TD><DIV class=buttonDiv><A class="button button_blue" href="#"><SPAN>AttackThis page has hundreds of DIVs and SPANs so I am wondering if I can get the tag by class somehow?Hopefully other people who read this can get a better feel for how to use the AWESOME IE.au3 features too!THanks again!
misjdd Posted October 20, 2008 Author Posted October 20, 2008 Hint: _IETagnameGetCollection( , "span", index) and _IEAction( , "click")Actually I got it now:$oInputs = _IETagnameGetCollection( $oie , "span")For $oInput In $oInputs $test = _iepropertyget($oInput, "innerhtml") if $test = "Hit List" then $hit = $oInput if $test = "Main" then $main = $oInput if $test = "Hospital" then $hospital = $oInput if $test = "Attack" then $attack = $oInput if $test = "Fight" then $fight = $oInput if StringInStr($test, "Heal yourself") then $healyourself = $oInput if $test = "Bank" then $bank = $oInput if $test = "Deposit" then $deposit = $oInput NextI am having trouble grabbing a DIV item, but I think I get the concept enough to figure it out on my own. Thanks Dale for your help!
Manic Posted June 28, 2011 Posted June 28, 2011 Cross-domain scripting limitations are built in to IE. You can get the source URL of the iFrame, and then try to open that in its own instance of IE or a tab (if IE7). Some sites don't allow that page to be loaded directly, in which case you're out of luck.You won't know until you try.If you cannot access the iFrame in it's own window, am I S.O.L. if scripting with AutoIt?
PsaltyDS Posted June 29, 2011 Posted June 29, 2011 Probably, but the limitation is not AutoIt's. It's an intended behavior of the IE DOM. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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