selenium新手專用手冊,可以避免很多坑喲

1 、新手安裝教程可以參照:https://www.yiibai.com/selenium/selenium_environment_setup.html

2、運行過程中如遇到以下提示:Exception in thread "main" java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system property; for more information, see https://github.com/mozilla/geckodriver. The latest version can be downloaded from https://github.com/mozilla/geckodriver/releases

請在WebDriver driver = new FirefoxDriver();前添加以下代碼:

System.setProperty("webdriver.gecko.driver","F:\\selenium\\geckodriver-v0.15.0-win64\\geckodriver.exe");

WebDriver driver = new FirefoxDriver();

其中"F:\\selenium\\geckodriver-v0.15.0-win64\\geckodriver.exe"是本地存放地址;

可以在https://github.com/mozilla/geckodriver/releases下載對應的版本,下載時注意查看其支持的Firefox版本和selenium版本;


3、selenium使用中遇到的問題Exception in thread "main" org.openqa.selenium.WebDriverException:相關問題時,可以在https://blog.csdn.net/funi16/article/details/9036753中查看解決辦法

4、總之:新手入門時一定要看好版本對應,如果selenium,Firefox版本對應不上會走很多彎路的:

本人使用版本:

Firefox Setup 52.0.2

selenium-server-standalone-3.11.0

selenium-java-3.11.0

geckodriver-v0.15.0-win64

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