我正在尝试使用 selenium 从带有 python 脚本的网站自动下载数据,但出现以下错误:
"WebDriverException: Message: TypeError: rect is undefined".
Run Code Online (Sandbox Code Playgroud)
代码试用:
from selenium import webdriver
from selenium.webdriver.common import action_chains
driver = webdriver.Firefox()
url="https://www.hlnug.de/?id=9231&view=messwerte&detail=download&station=609"
driver.get(url)
Run Code Online (Sandbox Code Playgroud)
现在我定义了要单击的复选框并尝试单击它:
temp=driver.find_element_by_xpath('//input[@value="TEMP"]')
action = action_chains.ActionChains(driver)
action.move_to_element(temp)
action.click()
action.perform()
Run Code Online (Sandbox Code Playgroud)
我已经在网上搜索了 2 个小时,但没有任何成功。因此,欢迎任何想法!
非常感谢!
每次尝试将文本插入网页上的 CodeMirror 时,我都会收到以下错误消息。有谁知道如何使用selenium成功编辑codemirror?
WebDriverException: Message: unknown error: Cannot read property 'setValue' of undefined
Run Code Online (Sandbox Code Playgroud)
这是我的 Selenium-Python 代码
def click_component_script_editor(self):
driver = self.driver
line18Edit = self.driver.find_element(By.XPATH, "//html//div[@class='CodeMirror-line']//div[18]/pre[1]")
driver.execute_script("arguments[0].CodeMirror.setValue(arguments[1]);",
line18Edit,
"foo.bar")
Run Code Online (Sandbox Code Playgroud)