本文介绍了导入 JavascriptExecutor (Selenium)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可能遗漏了一些东西,但在我检查过的每个示例中,JavascriptExecutor 接口都是通过添加
I might be missing something, but in every example I've inspected, JavascriptExecutor interface was imported simply by adding
import org.openqa.selenium.JavascriptExecutor
出于某种原因,它似乎对我不起作用.当我尝试这样做时,我收到此错误:
For some reason, it doesn't seem to work for me. When I try that, I receive this error:
ImportError: No module named org.openqa.selenium.JavascriptExecutor
有人知道怎么解决吗?我将不胜感激.
Does anyone know how to solve it? I'd be profoundly thankful.
推荐答案
这是 Java 导入,而不是 Python.无论如何,您不需要任何导入,因为 WebDriver
内置了运行 JavaScript 的函数
This is a Java import, not Python. Any way, you don't need any import as the WebDriver
has built in function to run JavaScript
driver.execute_script('script')
这篇关于导入 JavascriptExecutor (Selenium)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!