錯(cuò)誤信息:
java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: java.lang.RuntimeException: java.lang.RuntimeException: Firefox could not be found in the path!
Please add the directory containing ''firefox.exe'' to your PATH environment
variable, or explicitly specify a path to Firefox like this:
*firefox c:\blah\firefox.exe

原因:找不到firefox(火狐不是默認(rèn)安裝位置自己換了位置的),不能打開瀏覽器
解決方案:
方法一:設(shè)置環(huán)境變量,將火狐的地址放進(jìn)path變量中
方法二:將火狐的路徑寫進(jìn)來(lái),注意路徑的\要用\\,其中一個(gè)\是轉(zhuǎn)義的意思
即下面的"*firefox"改為 "*firefox D:\\study\\selenium\\Firefox\\firefox.exe"