Jump to content

Webdriver iFrame nested hell - (Moved)


JeffO
 Share

Recommended Posts

Hi,

Working on automating task on Microsoft Dynamics 365 site and it's a mess of nested iFrame. Not only are they nested like two or three level deep, but they don't have name ID, just some (hopefully static) http address.  I'm no programmation wiz but I can work my way around anything, if I have examples to shamelessly copy from. :)

Do you guys had to deal with loosely named nested iFrames like that ? Looking for a way to easily go through , selecting and attaching to the right one. If you have examples involving web dynamics, even better.

Thanks,

Jeff

 

Edited by JeffO
Better title
Link to comment
Share on other sites

  • Developers

Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states:

Quote

Share your cool AutoIt scripts, UDFs and applications with others.


Do not post general support questions here, instead use the AutoIt Help and Support forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Hi Danp2,

Edit : Browser is Chrome

Well, it's complicated... I thought webdriver was defective so I involved a DEV friend who analysed the problem with me. Thing is, he's a python guy and we successfully tackle the problem in this language. Mainly because with the help of VisualStudio debugger we were able to see how the iFrame were nested and indexed. I assume object manipulation is similar, give or take some commas and quotes.

(I leave out the standard library loading, the authentication which is really simple)

So here how I successfully instantiated the inbedded iFrame

page = page.mainFrame.childFrames[0].page.frames[2]

This will most likely fail sooner than later because the iFrame nesting is unstable and if someone sneeze by the browser it might work anymore.

So, what I need to do is find a way to list all the iFrame (back on auto-it, I don't master python) on a page down to the last nested one, find the right one by either name or other criteria and attach to it.

Many thanks,

Jeff 

Edited by JeffO
Forgot a tiny important piece of information, the browser !!
Link to comment
Share on other sites

Would that be helpful to you ?

ConsoleWrite("Frames=" & _WD_GetFrameCount($sSession) & @CRLF)
  Local $aTag = _WD_FindElement($sSession, $_WD_LOCATOR_ByTagName, "iFrame", Default, True)
  _ArrayColInsert($aTag, 1)
  _ArrayColInsert($aTag, 1)
  For $i = 0 To UBound($aTag)-1
    $aTag[$i][1] = _WD_ElementAction($sSession, $aTag[$i][0], "attribute", "name")
    $aTag[$i][2] = _WD_ElementAction($sSession, $aTag[$i][0], "attribute", "id")
  Next
  _ArrayDisplay($aTag)

 

Link to comment
Share on other sites

Nine-Neuf,

Looks promising ! I will try it tonite, I'll keep you posted.

1 hour ago, Nine said:

Would that be helpful to you ?

ConsoleWrite("Frames=" & _WD_GetFrameCount($sSession) & @CRLF)
  Local $aTag = _WD_FindElement($sSession, $_WD_LOCATOR_ByTagName, "iFrame", Default, True)
  _ArrayColInsert($aTag, 1)
  _ArrayColInsert($aTag, 1)
  For $i = 0 To UBound($aTag)-1
    $aTag[$i][1] = _WD_ElementAction($sSession, $aTag[$i][0], "attribute", "name")
    $aTag[$i][2] = _WD_ElementAction($sSession, $aTag[$i][0], "attribute", "id")
  Next
  _ArrayDisplay($aTag)

 

 

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