简体   繁体   English

Selenium,Firefox和GeckoDriver

[英]Selenium, Firefox and GeckoDriver

I have a question and a problem. 我有一个问题和一个问题。

Question : 问题
By using Selenium 3.4.0 what is the latest version of Firefox that doesn't require GeckoDriver to run tests. 通过使用Selenium 3.4.0,最新版本的Firefox不需要GeckoDriver来运行测试。 Because using Firefox 45 i can run tests without GeckoDriver, although i thought it is required. 因为使用Firefox 45我可以在没有GeckoDriver的情况下运行测试,尽管我认为这是必需的。

Problem : 问题
I'm trying to use Firefox latest version 53.0, Selenium 3.4.0 and GeckoDriver 0.16.0 我正在尝试使用Firefox最新版本53.0,Selenium 3.4.0和GeckoDriver 0.16.0
I set Firefox to the PATH. 我将Firefox设置为PATH。 I set the path properties for Gecko as follows in this class: enter image description here , Stack trace: 我在这个类中按如下方式设置Gecko的路径属性:在此输入图像描述 ,堆栈跟踪:

1493481035911   geckodriver INFO    Listening on 127.0.0.1:32281 1493481036538  geckodriver::marionette INFO    Starting browser \\?\C:\Program Files (x86)\Mozilla Firefox\firefox.exe with args ["-marionette"] 1493481037661 addons.manager  ERROR   startup failed: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIFile.create]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: resource://gre/modules/FileUtils.jsm :: FileUtils_getDir :: line 70"  data: no] Stack trace: FileUtils_getDir()@resource://gre/modules/FileUtils.jsm:70 < FileUtils_getFile()@resource://gre/modules/FileUtils.jsm:42 < validateBlocklist()@resource://greJav/amSocdruilpets /eArdrdoorn:M arnageers.ojusrmc:e6:7/1/ g<r es/tmaordtuulpe(s)/@ArdedsoonuMracnea:g/e/rg.rjes/mm,o dluilnees /1A6d5d7o:n MNaSn_aEgReRrO.Rj_sNmO:T_INIT8I3A4L I<Z EsDt:a rAtdudpo(n)M@arneasgoeurr cies: /n/ogtr ei/nmiotdiualleized
s/AddonManager.jsm:3129 < observe()@resource://gre/components/addonManager.js:65
[GFX1]: Potential driver version mismatch ignored due to missing DLLs 0.0.0.0 and 0.0.0.0
1493481041925   Marionette  INFO    Listening on port 54083
JavaScript error: resource://gre/modules/AddonManager.jsm, line 2570: NS_ERROR_NOT_INITIALIZED: AddonManager is not initialized
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, browserName=firefox, moz:firefoxOptions=org.openqa.selenium.firefox.FirefoxOptions@150c158, version=, platform=ANY, firefox_profile=org.openqa.selenium.firefox.FirefoxProfile@4524411f}], required capabilities = Capabilities [{}]
Build info: version: 'unknown', revision: '8c03df6', time: '2017-03-02 09:30:17 -0800'
System info: host: 'DESKTOP-HUOROU4', ip: '192.168.43.167', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:91)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:604)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:244)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:293)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:272)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:267)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:130)
    at Test.main(Test.java:11)

Let me try to address your question one by one: 让我试着逐一解决你的问题:

  1. By using Selenium 3.4.0 what is the latest version of Firefox that doesn't require GeckoDriver to run tests - With Selenium 3.4.0 you can use Mozilla Firefox 47.x without gecko driver. By using Selenium 3.4.0 what is the latest version of Firefox that doesn't require GeckoDriver to run tests - 使用Selenium 3.4.0,您可以使用没有gecko驱动程序的Mozilla Firefox 47.x. From Mozilla Firefox 47.x on-wards gecko driver is mandatory. 从Mozilla Firefox 47.x on-wards壁虎驱动程序是必需的。

  2. With Selenium 3.4.0, geckodriver v0.16.1 & Mozilla Firefox 53.0 this piece of code works fine: 使用Selenium 3.4.0,geckodriver v0.16.1和Mozilla Firefox 53.0这段代码可以正常工作:

     System.setProperty("webdriver.gecko.driver", "C:\\\\Utility\\\\BrowserDrivers\\\\geckodriver.exe"); DesiredCapabilities dc = DesiredCapabilities.firefox(); dc.setCapability("marionette", true); WebDriver driver = new FirefoxDriver(dc); driver.get("http://google.com/"); 

Moreover, if you are using any extensions in your default Firefox profile either you need to disable/delete them or create a new Firefox profile for your automation work. 此外,如果您在默认的Firefox配置文件中使用任何扩展,则需要禁用/删除它们或为自动化工作创建新的Firefox配置文件。

Let me know if this helps you. 如果这有助于您,请告诉我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firefox不是使用Geckodriver和Selenium推出的 - 它适用于Chrome - Firefox is not launched using Geckodriver and Selenium - It works with Chrome Selenium - Geckodriver (Firefox) 加载解压扩展 - Selenium - Geckodriver (Firefox) load unpacked extension 如何通过GeckoDriver和Selenium启动Firefox浏览器 - How to launch Firefox browser through GeckoDriver and Selenium 如何使用 GeckoDriver Firefox 和 Selenium 下载文件? - How to download files using GeckoDriver Firefox and Selenium? 如何在带有硒2.53.0的geckodriver上使用最新的Firefox浏览器运行硒脚本? - How to run selenium script with latest firefox browser on geckodriver with selenium 2.53.0? 通过 Selenium 和 Java 使用 GeckoDriver 和 Firefox 无法点击链接 - Link is not clickable using GeckoDriver and Firefox through Selenium and Java Selenium Webdriver刚刚停止使用GeckoDriver在Firefox浏览器上工作 - Selenium webdriver just stop working for Firefox browser with GeckoDriver 使用GeckoDriver运行Java Selenium WebDriver时,Firefox无法连接 - Firefox Cannot Connect When Running Java Selenium WebDriver With GeckoDriver 如何使用 Geckodriver 在 Selenium 中禁用 Firefox 登录? - How do I disable Firefox logging in Selenium using Geckodriver? 无法使用Selenium 3.0.0-beta3与Geckodriver启动Firefox 41 - Failed to launch Firefox 41 with Geckodriver using Selenium 3.0.0-beta3
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM