SeleniumLibrary icon indicating copy to clipboard operation
SeleniumLibrary copied to clipboard

Fix and cleanup logic related to frames

Open pekkaklarck opened this issue 8 years ago • 11 comments

There are currently several problems with handling frames that should be resolved. Some of these problems are already covered by existing issues, but this new issue list all these highly related problems in one place. The whole frame handling logic should be rewritten and all these problems resolved at the same time.

  1. Page Should (Not) Contain searches text from frames, but only searches from one level and not from sub frames (#98)
  2. Other keywords don't look inside frames at all. This includes Page Should (Not) Contain Element and Current Frame Should (Not) Contain. (#98)
  3. Page Should (Not) Contain internally selects the main frame, disabling earlier Select Frame calls.(#201)
  4. We should see could we deprecate all Current Frame ... keywords. It would be better that after selecting a frame, all subsequent keywords would operate in the frame. This may actually already be the case, except with Page Should (Not) Contain which looks from the root (see 3. above).
  5. If all keywords operate on the selected frame, Page Should is pretty misleading wording. Should we consider renaming these keywords like Page Should Contain -> Text Should Be Present, Page Should Contain Element -> Element Should Be Present?

pekkaklarck avatar Oct 18 '17 09:10 pekkaklarck

Additionally to the problems already listed, there is a similar problem with the Frame Should Contain Keyword, the driver is switched back to the default context, which is undesirable when working on sub frames. (expected to end up at the window/frame that we started from, not the main window).

mcleanmds avatar Feb 02 '18 05:02 mcleanmds

Any update on this one?

tmaleckiplacester avatar Aug 30 '19 12:08 tmaleckiplacester

There is not progress for this issue because no-one has seen it enough important to invest time.

aaltat avatar Aug 30 '19 13:08 aaltat

@pekkaklarck Do we have some progress in this issue :)

MininAS avatar May 04 '20 05:05 MininAS

Nothing has happened since my last comment.

aaltat avatar May 04 '20 05:05 aaltat

Hi, My problem is related to frames management with RFW but I don't know if it's the right place to discuss about it.

I'm using RFW 3.2.2 with Python 3.9 on Windows with FF or Chrome.

I'm working on a app with lots of frames which contains iframes, some are dynamically created...

  • Page
    • Frame1
      • IFrame1
      • IFrame2 (not created yet)
    • Frame2
    • Frame3

Select Frame Frame1 is OK Select Frame IFrame1 is OK (Displays a form) Input Text Name Hello is OK Click Button Save (button in the IFrame1) is OK (by clicking this button, the app dynamically creates a new iframe IFrame2) Unselect Frame Select Frame IFrame2

IFrame2 can't be selected. If I execute javascript to get the reference, I can get it but I then get the StaleReferenceException if I try to select it through Select Frame

Any ideas?

jck1307 avatar Nov 03 '20 09:11 jck1307

Ok, I found the solution. As I read somewhere in another issue, Unselect Frame returns you to the top parent, so the solution was to look for the elements from the beginning.

So after the Unselect Frame, I now do:

Select Frame Frame1 Select Frame IFrame2

and everything works like a charm.

But the issue about the top parent is annoying because really not intuitive.

Sorry to have bothered you for so little things but I was going crazy...

Thanks for the work, RFW is really interesting.

JC

jck1307 avatar Nov 03 '20 10:11 jck1307

Yes, we do not keep track of the frames and Selenium API only allows to select top most page.

If that is not documented, then it should be fixed.

aaltat avatar Nov 03 '20 16:11 aaltat

Indeed, in the docs (https://robotframework.org/Selenium2Library/Selenium2Library.html#Unselect%20Frame) it is written:

  • Unselect Frame : Sets the main frame as the current frame. In practice cancels the previous Select Frame call.

It should be better to say it cancels all the previous Select Frame calls and sets you to the top, not the direct parent.

All is a little word, but it matters :-D

JC

jck1307 avatar Nov 03 '20 16:11 jck1307

Yes, that could be enhanced. Would you like make a PR to fix it?

aaltat avatar Nov 03 '20 17:11 aaltat

Please remember that Selenium2Library is not maintained and correct project is https://github.com/robotframework/SeleniumLibrary#keyword-documentation (Although the text is same in both)

aaltat avatar Nov 03 '20 17:11 aaltat