0

I have a native android app. In which there is a web view and then it contain a payment iframe. I am unable to switch to iframe. I have tried the following but all of them are giving the same error:

switch to frame    PAYMENT_CARD_IFrame --> not working
switch to frame    xpath=//iframe[1] --> not working
switch to frame    xpath=//iframe[@id="PAYMENT_CARD_IFrame"] --> not working
switch to frame    id=PAYMENT_CARD_IFrame--> not working

All of them are generating same error which is:

InvalidArgumentException: Message: invalid argument: invalid locator
(Session info: chrome=96.0.4664.104)
Sammar Ahmad
  • 236
  • 5
  • 16

1 Answers1

0

Check for the driver contexts first and then switch.

print(driver.contexts)
webview = driver.contexts[1]
driver.switch_to.context(webview)

And make sure webview debug is enabled

Nithin Mohan
  • 372
  • 1
  • 9