duyanhhz
duyanhhz

Reputation: 65

Switch to frame Python Selenium

I'm trying to switch to this frame

   <iframe class="wrapper" 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" class="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=%23000000&amp;metaiconclr=%23757575&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%3A%2F%2Fpaypal-api.arkoselabs.com%2Fcdn%2Ffc&amp;lurl=https%3A%2F%2Faudio-ap-southeast-1.arkoselabs.com&amp;surl=https%3A%2F%2Fpaypal-api.arkoselabs.com&amp;smurl=https%3A%2F%2Fpaypal-api.arkoselabs.com%2Fcdn%2Ffc%2Fassets%2Fstyle-manager"></iframe>

How can I make it? Please help me

Upvotes: 1

Views: 560

Answers (1)

ketanvj
ketanvj

Reputation: 511

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

Upvotes: 3

Related Questions