panther
panther copied to clipboard
Possible to access iframe content?
@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?
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();
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?
@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.