I am using an undetectable Chrome Selenium webdriver in python to try and capture all iframe
elements within the div
tag with the px-captcha
id. The html section I am trying to get from the whole page source looks as such:
<div id="px-captcha" role="region" aria-label="Human challenge" style="display: block; min-width: 310px;">
<iframe style="display: none; width: 100%; height: 100px; border: 0px; user-select: none;" token="464ad1a7b7ed017f8c60542b859c5333648d76b8ec128a4f886c558900ffbe63dda2831825532a9be2d1f224eee47121e522391c7dcd7c55e86e1f17ebe944b7" title="Human verification challenge"></iframe>
<iframe style="display: none; width: 100%; height: 100px; border: 0px; user-select: none;" token="464ad1a7b7ed017f8c60542b859c5333648d76b8ec128a4f886c558900ffbe63dda2831825532a9be2d1f224eee47121e522391c7dcd7c55e86e1f17ebe944b7" title="Human verification challenge"></iframe>
<iframe style="display: none; width: 100%; height: 100px; border: 0px; user-select: none;" token="464ad1a7b7ed017f8c60542b859c5333648d76b8ec128a4f886c558900ffbe63dda2831825532a9be2d1f224eee47121e522391c7dcd7c55e86e1f17ebe944b7" title="Human verification challenge"></iframe>
<iframe style="display: none; width: 100%; height: 100px; border: 0px; user-select: none;" token="464ad1a7b7ed017f8c60542b859c5333648d76b8ec128a4f886c558900ffbe63dda2831825532a9be2d1f224eee47121e522391c7dcd7c55e86e1f17ebe944b7" title="Human verification challenge"></iframe>
<iframe style="display: none; width: 100%; height: 100px; border: 0px; user-select: none;" token="464ad1a7b7ed017f8c60542b859c5333648d76b8ec128a4f886c558900ffbe63dda2831825532a9be2d1f224eee47121e522391c7dcd7c55e86e1f17ebe944b7" title="Human verification challenge"></iframe>
<iframe style="display: none; width: 100%; height: 100px; border: 0px; user-select: none;" token="464ad1a7b7ed017f8c60542b859c5333648d76b8ec128a4f886c558900ffbe63dda2831825532a9be2d1f224eee47121e522391c7dcd7c55e86e1f17ebe944b7" title="Human verification challenge"></iframe>
<iframe style="display: none; width: 100%; height: 100px; border: 0px; user-select: none;" token="464ad1a7b7ed017f8c60542b859c5333648d76b8ec128a4f886c558900ffbe63dda2831825532a9be2d1f224eee47121e522391c7dcd7c55e86e1f17ebe944b7" title="Human verification challenge"></iframe>
<iframe style="display: none; width: 100%; height: 100px; border: 0px; user-select: none;" token="464ad1a7b7ed017f8c60542b859c5333648d76b8ec128a4f886c558900ffbe63dda2831825532a9be2d1f224eee47121e522391c7dcd7c55e86e1f17ebe944b7" title="Human verification challenge"></iframe>
<iframe style="display: block; width: 100%; height: 100px; border: 0; -moz-user-select: none; -khtml-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none;" token="464ad1a7b7ed017f8c60542b859c5333648d76b8ec128a4f886c558900ffbe63dda2831825532a9be2d1f224eee47121e522391c7dcd7c55e86e1f17ebe944b7" title="Human verification challenge"></iframe>
<iframe style="display: none; width: 100%; height: 100px; border: 0px; user-select: none;" token="464ad1a7b7ed017f8c60542b859c5333648d76b8ec128a4f886c558900ffbe63dda2831825532a9be2d1f224eee47121e522391c7dcd7c55e86e1f17ebe944b7" title="Human verification challenge"></iframe>
<p id="ejjpkyuhrAUbSZp" role="alert" style="color: #e50000; display: inline-block; margin: 0; vertical-align: middle;"></p>
</div>
I manage to get the px-captcha
id with:
element = driver.find_element(By.ID,'px-captcha')
This gives me a WebElement from which I want to get all the iframe
elements. I tried it with this but it fails:
iframes = element.find_element(By.TAG_NAME,'iframe')
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"iframe"}
EDIT
The desired output is a list of the iframe
WebElements similar to the type given by element = driver.find_element(By.ID,'px-captcha')