Home > Mobile >  Switch to frame Python Selenium
Switch to frame Python Selenium

Time:09-28

I'm trying to switch to this frame

   <iframe  id="CaptchaFrame" title="画像認識" src="about:blank" horizontalscrolling="no" verticalscrolling="no" scrolling="no">
            </iframe>

But it is covered in another frame:

<iframe frameborder="0" scrolling="no" id="fc-iframe-wrap"  aria-label=" " style="width: 330px; height: 305px;" src="https://paypal-api.arkoselabs.com/fc/gc/?token=556633290cf3549a4.4740334104&amp;r=ap-southeast-1&amp;metabgclr=transparent&amp;guitextcolor=#000000&amp;metaiconclr=#757575&amp;meta=7&amp;meta_height=305&amp;meta_width=330&amp;lang=ja&amp;pk=9409E63B-D2A5-9CBD-DBC0-5095707D0090&amp;at=40&amp;ag=101&amp;cdn_url=https://paypal-api.arkoselabs.com/cdn/fc&amp;lurl=https://audio-ap-southeast-1.arkoselabs.com&amp;surl=https://paypal-api.arkoselabs.com&amp;smurl=https://paypal-api.arkoselabs.com/cdn/fc/assets/style-manager"></iframe>

How can I make it? Please help me

CodePudding user response:

@duyanhhz you can first switch to the outer iframe and then you can switch into the one you want.

outer = driver.find_element(By.ID, "fc-iframe-wrap")
driver.switch_to.frame(outer)
inner = driver.find_element(By.ID, "CaptchaFrame")
driver.switch_to.frame(inner)
  • Related