相关疑难解决方法(0)

html中的Selenium和iframe

无法对iframe使用send_key().如何选择这个iframe以及其中的哪个元素应该用于send_key()?

页面图像

和iframe HTML代码

<iframe class="textarea" src="/framework/html/blank.html" style="width: 99%; border-width: 1px; height: 332px;">
#document
<html webdriver="true">
<head>
</head>
<body> … </body>
</html>
</iframe>
Run Code Online (Sandbox Code Playgroud)

如何将值发送到描述?

还有一件事我想知道当我在浏览器中查看"查看页面源"时,这个框架代码不会出现吗?

python iframe selenium selenium-webdriver

25
推荐指数
1
解决办法
3万
查看次数

13
推荐指数
2
解决办法
2万
查看次数

如何使用 Selenium 单击 cloudflare 的“验证您是人类”复选框挑战

我需要使用 Python 自动下载此网页中的 .csv 文件:

https://pace.coe.int/en/aplist/committees/9/commission-des-questions-politiques-et-de-la-democratie
Run Code Online (Sandbox Code Playgroud)

现在,我写了这段代码:

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
import time
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
 
chromedriver_path = r"./driver/chromedriver"
browser = webdriver.Chrome(executable_path=chromedriver_path)
url = "https://pace.coe.int/en/aplist/committees/9/commission-des-questions-politiques-et-de-la-democratie"
topics_xpath = '//*[@id="challenge-stage"]/div/label/span[2]'
browser.get(url)
time.sleep(5)  #Wait a little for page to load.
escolhe = browser.find_element("xpath", topics_xpath)
time.sleep(5)
escolhe.click()
time.sleep(5)
Run Code Online (Sandbox Code Playgroud)

网页打开,然后提示我单击“验证您是人类”:

在此输入图像描述

我已经“检查”了按钮并复制了 xpath(参见上面的代码)。但我收到这个错误:

NoSuchElementException: no such element: Unable to …
Run Code Online (Sandbox Code Playgroud)

iframe xpath cloudflare selenium-webdriver webdriverwait

5
推荐指数
2
解决办法
9741
查看次数