A
A
agent_22032021-12-18 21:49:17
Python
agent_2203, 2021-12-18 21:49:17

Why is selenium replacing iframe with dict?

61be2d6f43f33936379645.jpeg

I'm trying to get all the iframes on the site, there are a total of 12 of them, but selenium in the webElement gives out only the first two, for some reason it replaces the rest with a dict

driver.find_elements(By.TAG_NAME, 'iframe')


[<selenium.webdriver.remote.webelement.WebElement (session="3778147fe7f7578c58582ae8c7ffdd6e", element="f93ba67f-c6f7-417b-8d43-cd283ada8ffd")>, <selenium.webdriver.remote.webelement.WebElement (session="3778147fe7f7578c58582ae8c7ffdd6e", element="d9f42d67-02bf-4a21-b0ae-aa6486e69c8d")>, {}, {}, {}, {}, {}, {}, {'ontouchmove': {}, 'ontouchstart': {}}, {}, {}, {}]


What could be the reason for this and how can I get all iframes?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
ab1, 2021-12-19
@ab1

1.Add print(driver.page_source) before find elements, compare with browser file
2.If page is dynamic, do time.sleep or other kind of delay before find_elements.
3. Fyi: Settlement + chrome is a bot, protection from a bot is visible on the page
UPD
What is the address of the old woman and how does it look like?
4. I found 2 iframes on a page in Chrome and FF + shadowdom element in them, see the picture below, google about it
I assume that the site marked you as suspicious and adds antibot protection
61c06112df92a617286679.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question