相关疑难解决方法(0)

如何在 Python 中使用 Selenium 编辑 CodeMirror?

每次尝试将文本插入网页上的 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)

python selenium codemirror

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

标签 统计

codemirror ×1

python ×1

selenium ×1