Selenimu運行腳本時遇到的與FF瀏覽器相關問題小結

錯誤信息1:

FAILED CONFIGURATION: @BeforeClass setUp
java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: Unable to delete file C:\Users\ADMINI~1\AppData\Local\Temp\customProfileDir9cf2c422885b4bb683e8f836a80a58be\parent.lock

原因:ff3.6與selenium1.0.1不兼容,服務器端使用selenium1.0.2以上的版本即可


錯誤信息2:

java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: java.lang.RuntimeException: Firefox 3 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 3 like this:
*firefox3c:\blah\firefox.exe

java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: org.openqa.selenium.server.browserlaunchers.InvalidBrowserExecutableException: The specified path to the browser executable is invalid.  

原因:找不到FF,不能打開瀏覽器
解決:1、把ff重新安裝一次,安裝路徑默認,不要修改
            2、在腳本中增加詳細的瀏覽器絕對路徑地址:

selenium = new DefaultSelenium("localhost", 4444, "*firefox D:\Program Files\Mozilla Firefox\firefox.exe","http://istock.jrj.com.cn/");

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章