Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to access iframe content? #446

Open
njsa04 opened this issue Mar 20, 2021 · 3 comments
Open

Possible to access iframe content? #446

njsa04 opened this issue Mar 20, 2021 · 3 comments

Comments

@njsa04
Copy link

njsa04 commented Mar 20, 2021

@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?

@halfer
Copy link
Contributor

halfer commented Mar 25, 2021

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
Copy link
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
Copy link
Contributor

halfer commented Apr 15, 2021

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants