public void setUp(){
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
driver = new ChromeDriver();
driver.get("http://book.theautomatedtester.co.uk/chapter4");
}
错误:
Started ChromeDriver port=14918 .\test\automation\proxy_launcher.cc(89): error: Value of: app_launched Actual: 1 Expected: AUTOMATION_SUCCESS Which is: 0 Error while awaiting automation ping from browser process .\test\automation\proxy_launcher.cc(223): error: Value of: automation()->GetBrowserWindowCount(&window_count) Actual: false Expected: true .\test\automation\proxy_launcher.cc(244): error: Value of: browser_proxy.get() Actual: false Expected: true .\test\automation\proxy_launcher.cc(269): error: Value of: WaitForBrowserProcessToQuit( TestTimeouts::action_max_timeout_ms(), &exit_code) Actual: false Expected: true .\test\automation\proxy_launcher.cc(270): error: Value of: exit_code Actual: -1 Expected: 0
答案 0 :(得分:1)
我怀疑它无法启动chromedriver.exe。在这一行:
System.setProperty("webdriver.chrome.driver", "chromedriver.exe");
重点是告诉它确切位于 chromedriver.exe 的位置,包括完整路径。您可能需要将其更改为:
System.setProperty("webdriver.chrome.driver", "C:\My\Path\To\chromedriver.exe");
正如ChromeDriver documentation所说:
确保服务器可以位于PATH上,或通过
webdriver.chrome.driver
系统属性指定其位置。