Javascript 如何避免Selenium';谁是司机?
我是新来的Javascript 如何避免Selenium';谁是司机?,javascript,selenium,htmlunit,selenium-chromedriver,htmlunit-driver,Javascript,Selenium,Htmlunit,Selenium Chromedriver,Htmlunit Driver,我是新来的Selenium,我正在尝试连接到一个站点 String url = [url][1] WebDriver driver = new HtmlUnitDriver(true); driver.get(url); 我在执行这一行时遇到JavaScript错误 我搜索了几个问题,也试了一下 driver.setJavascriptEnabled(true); 但它仍然在drive.get(url)行中生成相同的问题 我在这里找不到真正的问题 谁能告诉我这背后
Selenium
,我正在尝试连接到一个站点
String url = [url][1]
WebDriver driver = new HtmlUnitDriver(true);
driver.get(url);
我在执行这一行时遇到JavaScript错误
我搜索了几个问题,也试了一下
driver.setJavascriptEnabled(true);
但它仍然在drive.get(url)
行中生成相同的问题
我在这里找不到真正的问题
谁能告诉我这背后的主要问题是什么?
是不是页面加载时间稍长?
还是其他原因
我还粘贴了问题的输出文本。下面
Nov 23, 2015 5:03:15 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Obsolete content type encountered: 'application/x-javascript'.
Nov 23, 2015 5:03:17 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Obsolete content type encountered: 'application/x-javascript'.
Nov 23, 2015 5:03:21 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Obsolete content type encountered: 'application/x-javascript'.
Exception in thread "main" org.openqa.selenium.WebDriverException: com.gargoylesoftware.htmlunit.ScriptException:
TypeError: TypeError: redeclaration of const constructor.
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:55:52'
System info: host: 'User-PC', ip: '192.168.1.66', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.
version: '1.8.0_40'
Driver info: driver.version: HtmlUnitDriver
at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:554)
请提供URL,以便其他人检查@AhmedAshour link url=您无法避免javascript错误,您可以将其关闭,以防页面上不需要javascript才能正常工作,或者您可以将ThroweExceptionOnScriptError(不确定正确的名称,我上次使用它已有一段时间了)设置为false,以忽略所有javascript错误。这可能会导致应用程序无法正常工作。或者看看PhantomJS,它有更好的javascript支持