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

How to access a secure iframe? #453

Open
bastien70 opened this issue Apr 12, 2021 · 2 comments
Open

How to access a secure iframe? #453

bastien70 opened this issue Apr 12, 2021 · 2 comments

Comments

@bastien70
Copy link
Contributor

bastien70 commented Apr 12, 2021

Hello,

I am trying to use Panther to fill out a Stripe payment form. My Stripe fields are managed by Stripe itself from iframes generated in my form.


//Get iframe
$creditCardFrame = $this->client->findElement(WebDriverBy::cssSelector("#card-number > .__PrivateStripeElement > iframe"));

// returns : "iframe" and "__privateStripeFrame6225"
var_dump($creditCardFrame->getTagName(), $creditCardFrame->getAttribute('name'));

// Switch to iframe. (It should work no ?)
$this->client->switchTo()->frame($creditCardFrame);

// Trying to send keys in my own input (not a stripe field. It's on the default iframe). And I can.
$this->client->findElement(WebDriverBy::name('card-owner'))->sendKeys('my name');

// Trying to send keys in the cardnumber input (in a stripe iframe). Can't locate it.
$this->client->findElement(WebDriverBy::name('cardnumber'))->sendKeys("4242 4242 4242 4242");

These iframes seem protected, because when I switch to one of these iframes, it looks like I'm staying on my default frame and I can't access the frame of an input Stripe. In my opinion, this is because these are secure.

Is there a way to access it anyway?

I think I have to add this : --disable-site-isolation-trials but where ?

@Growiel
Copy link

Growiel commented Oct 21, 2021

Hi!

Sorry to bring this back from the dead. Did you figure it out ? I'm trying to do the same thing but I feel like it's impossible.

Thanks.

@ehibes
Copy link

ehibes commented Oct 27, 2021

Thanks to this issue #446 (comment), I succeeded to fill stripe's fields by doing this :

$myFrame = $client->findElement(WebDriverBy::cssSelector('#card-element iframe'));
$client->switchTo()->frame($myFrame);
$client->findElement(WebDriverBy::name('cardnumber'))->sendKeys("4242 4242 4242 4242");
$client->findElement(WebDriverBy::name('exp-date'))->sendKeys("0422");
$client->findElement(WebDriverBy::name('cvc'))->sendKeys("422");
$client->switchTo()->defaultContent();

Don't forget to add use section : use Facebook\WebDriver\WebDriverBy;

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