Selenium3.0beta版本啟動firefox瀏覽器的問題

來源:互聯網
上載者:User

        這兩天嘗試搭建Eclipse+Selenium的web自動化測試架構,使用Chrome和Firefox均出現問題,找不到Driver,經實踐,最終解決方案如下:

          環境:wIn10 x64 開發工具:Eclipse

         Jar版本:lib\selenium-server-standalone-3.0.0-beta2.jar,selenium-chrome-driver.jar,selenium-firefox-driver.jar.zip 下載連結:http://www.java2s.com/Code/Jar/CatalogJar.htm

         解決方案:

         瀏覽器:Chrome

          下載Chrome的Driver,在本地建立一個檔案夾,將Driver.exe檔案拷貝進去,比如說:C:/Program Files (x86)/Google/WebDriver/chromedriver.exe

          代碼如下:       

          System.setProperty("webdriver.chrome.driver",'C:/Program Files (x86)/Google/WebDriver/chromedriver.exe');           WebDriver driver = new ChromeDriver();          driver.get(http://"www.baidu.com");//開啟百度網頁

        瀏覽器:Firefox 46.01版本

         下載geckodriver.exe,連結:https://github.com/mozilla/geckodriver.exe,在本地建立一個檔案將,將geckodriver.exe拷貝進去,比如說:C:/Program Files/Mozilla                    Firefox/webdriver/,

        代碼如下:

    System.setProperty(“webdriver.gecko.driver","C:/Program Files/Mozilla Firefox/webdriver/geckodriver.exe");        RemoteWebDriver driver = new FirefoxDriver();        driver.get("http://www.baidu.com");


    

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.