Skip to content

Possible to access iframe content? #446

@njsa04

Description

@njsa04

@dunglas thanks for making this project.

I've been trying different ways to access iframe content.

$crawler = $client->switchTo()->frame('myframe') 

doesn't seem to work.

is this functionality supported? any recommendations?

Activity

halfer

halfer commented on Mar 25, 2021

@halfer
Contributor

What are you using for myframe? I think that needs to be a selector object, not a string.

Here is some code I have working in production:

$client->waitForVisibility('#Container iframe');
$myFrame = $client->findElement(WebDriverBy::cssSelector('#Container iframe'));
$client->switchTo()->frame($myFrame);

And then afterwards:

$client->switchTo()->defaultContent();
bastien70

bastien70 commented on Apr 10, 2021

@bastien70
Contributor

Is the crawler updated when we move from one frame to another? I tried what you said above, but I feel like I failed to switch to the frame, because I can't access a field in the frame, and the reverse, I can access a field from the default frame.

How to make sure to have correctly switched frames and to have the right crawler?

halfer

halfer commented on Apr 15, 2021

@halfer
Contributor

@bastien70 - I don't think I can help further. If you can provide a ready-to-go minimal reproducible sample in Docker Compose, I can take a look at it.

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

        Participants

        @halfer@njsa04@bastien70

        Issue actions

          Possible to access iframe content? · Issue #446 · symfony/panther