Skip to content

"wait until page contains element" doesn't find elements located in iframe #62

Closed

Description

@PavloSI

quell code:

*** Variables ***
${userFieldLocator}         xpath=//*[@id="username"]
...

*** Test Cases ***
ExampleTestCase
         wait until page contains element         ${userFieldLocator}
...

error:


ValueError: Element locator 'xpath=//*[@id="username"]' did not match any elements.

Element '${userFieldLocator}' is located in iframe

This simple example works with 'SeleniumLibrary'

Activity

  1. j1z0 commented on Jun 9, 2012

    @j1z0
    Contributor

    This is correct and as per the design. Frames and iframes consist of a separate HTML page than the 'main page' containing them. Thus u would have to select and switch to the frame first as then wait for the element.

    I'm not saying this is how it should be. I'm just saying this is how it's always been designed....

    In addition there is a related issue about the iframe support not really working at all. Which has been resolved in the iframe branch but there are design reasons why we haven't merged the iframe branch yet. So if u really need the support straight away u can get the iframe branch and it will work for you assuming u follow the steps outline in the first paragraph.

    Cheers,
    Jeremy

    On Jun 8, 2012, at 15:57, PavloSIreply@reply.github.com wrote:

    quell code:

    *** Variables ***
    ${userFieldLocator} xpath=//*[@id="username"]
    ...

    *** Test Cases ***
    ExampleTestCase
    wait until page contains element ${userFieldLocator}
    ...

    error:

    ValueError: Element locator 'xpath=//*[@id="username"]' did not match any elements.

    Element '${userFieldLocator}' is located in iframe

    This simple example works with 'SeleniumLibrary'


    Reply to this email directly or view it on GitHub:
    #62

  2. r-chris commented on Nov 23, 2018

    @r-chris

    I thought it may be helpful for anyone else stumbling onto this to add that you can select an iframe like this:

    Select Frame    xpath=//iframe
    

    This works if you only have a single iframe, but if you are looking to select a specific iframe you would have to expand the xpath appropriately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions