python selenium cant find elements in iframe

To find elements within an iframe using selenium, you’ll need to use the driver’s switch_to.frame() method:

i_frame = driver.find_element_by_id("iframe_id")
driver.switch_to.frame(i_frame)

Now you can locate elements as normal

Why does this happen?

Selenium initally looks for the first HTML tag available in the page. However, iframes have their very own second HTML tag, thus its necessary to switch back and forth when finding elements.  

SNAPPED!

SNAPPED!

Comments

  1. 1XBet
    Betting in India. It can be great to find the most popular casinosites.one brands, especially ones that offer betting casino-roll.com on 1xbet korean sports such as football, tennis,  Rating: herzamanindir.com/ 1/10 · ‎Review by Riku VihreasaariWhere 토토 사이트 can I find 1xbet?Where can I find 1xbet betting?

    ReplyDelete

Post a Comment

Popular posts from this blog

Append to a json file python

Setup Mailhog mail server on Ubuntu