我使用硒和Java編寫測試,我添加下面的代碼,看看我使用的是錯誤的Chrome司機發現錯誤,的try-catch不從「System.setProperty」
try {
System.setProperty("webdriver.chrome.driver", "Chrome Drivers\\chromedriverLinux32");
} catch (Exception e) {
System.out.println(1);
e.printStackTrace();
}
但每當它發生,測試拋出:
Jan 14, 2016 11:04:25 AM org.openqa.selenium.os.UnixProcess checkForErrorSEVERE: org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "C:\Users\sina\Desktop\WorkSpace\CowZAllPages\Chrome Drivers\chromedriverLinux32" (in directory "."): CreateProcess error=193, %1 is not a valid Win32 application)
但漁獲確實發現錯誤(System.out.println(1);
是沒見過)。
我還爲'driverChrome = new hromeDriver(capabilities)添加了try-catch;'但是它也沒有得到錯誤:( – LoveJavaTwo
哪一行代碼導致異常?那將是第1步開始 –
嗯,我發現它是由'driverChrome = new ChromeDriver(capabilities)引起的;''Exception e''無法抓住它!! – LoveJavaTwo