当我尝试通过PhantomJS连接到facebook.com时,我收到此错误。我找不到解决方案。
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.phantomjs.PhantomJSDriver;
import org.openqa.selenium.phantomjs.PhantomJSDriverService;
import org.openqa.selenium.remote.DesiredCapabilities;
public class SeleniumDemo {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
DesiredCapabilities caps = new DesiredCapabilities();
caps.setJavascriptEnabled(true);
caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "E:/ProjectTrials/phantomjs-2.1.1-windows/phantomjs-2.1.1-windows/bin/phantomjs.exe");
System.out.println("c1");
WebDriver driver = new PhantomJSDriver(caps);
System.out.println("c2");
driver.get("https://www.facebook.com");
System.out.println("c3");
System.out.println("Page Title: " + driver.getTitle());
}
}