我如何使用Python中的Selenium编辑CodeMirror?

2024-09-29 00:12:45 发布

您现在位置:Python中文网/ 问答频道 /正文

每次我试图在我的网页上的CodeMirror中插入文本时,都会收到下面的错误消息。有人知道如何用selenium成功地编辑codemirror吗?在

WebDriverException: Message: unknown error: Cannot read property 'setValue' of undefined

这是我的Selenium Python代码

^{pr2}$

Tags: 文本消息编辑网页messagereadselenium错误
1条回答
网友
1楼 · 发布于 2024-09-29 00:12:45

找到了这个问题的答案,我不得不使用actionChains而不是常规的send_密钥。在

codeMirror = self.driver.find_element(".CodeMirror")
action_chains.click(codeMirror).perform()
action_chains.send_keys("Hello World").perform()

相关问题 更多 >