JBrowserDriver异常

时间:2016-08-02 08:14:31

标签: java headless-browser

。我一直在开发一个网络爬虫,我只想在我的项目中实现JBroserDriver。

JBrowserDriver

当我创建JBroserDriver的insance时,我遇到了类似的异常:

org.openqa.selenium.WebDriverException:无法启动浏览器。

驱动程序信息:driver.version:JBrowserDriver

at com.machinepublishers.jbrowserdriver.Util.handleException(Util.java:140)〜[jbrowserdriver-0.16.3.jar:?]

at com.machinepublishers.jbrowserdriver.JBrowserDriver。(JBrowserDriver.java:282)~ [jbrowserdriver-0.16.3.jar:?]

这是我的代码块

                linkedHashMap.put("Host", "dynamic_header");
                linkedHashMap.put("Connection", "keep-alive");
                linkedHashMap.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
                linkedHashMap.put("Upgrade-Insecure-Requests", "1");
                linkedHashMap.put("User-Agent", "dynamic_header");
                linkedHashMap.put("Referer", "dynamic_header");
                linkedHashMap.put("Accept-Encoding", "gzip, deflate, sdch");
                linkedHashMap.put("Accept-Language", "en-US,en;q=0.8");
                linkedHashMap.put("Cookie", "dynamic_header");

                RequestHeaders requestHeaders = new RequestHeaders(linkedHashMap);

                Settings.Builder builder = Settings.builder().requestHeaders(requestHeaders);

                builder.ajaxWait(AppConstants.getJavascriptAjaxRuntime());

                builder.logJavascript(true);
                builder.logTrace(true);

                **driver = new JBrowserDriver(builder.build());**

你有什么想法解决方案吗? 感谢

0 个答案:

没有答案