c# Selenium 2.53 moving to marionette driver after firefox upgrade to 47

前端 未结 3 1726
死守一世寂寞
死守一世寂寞 2020-12-18 13:09

I am trying to move into the upgraded firefox web browser automation using selenium. It seems that selenium needs marionette driver to continue working. I followed the instr

相关标签:
3条回答
  • 2020-12-18 13:16

    First of all, you need to add the driver to your system path, not as an env variable. Second, you need to set the flag in a desired capability, not a Firefox option. See: Marionette Webdriver

    As such for remote webdriver:

    DesiredCapabilities capabilities = DesiredCapabilities.Firefox();  
    capabilities.SetCapability("marionette", true); 
    var driver = new RemoteWebDriver(capabilities); 
    

    To add the webdriver to your windows path:

    The easiest way is to open the start menu > search for environment > open edit the system environment variables > click on environment variables > search in the list for Path > click on edit > add ;C:\path\to\webdriver\location\wires.exe to the end and click save.

    For your local (non-webdriver) tests you are right, you can run your webdriver using the following:

    var driver = new FirefoxDriver(new FirefoxOptions());

    You should not have to use

    option1.IsMarionette = true; option1.AddAdditionalCapability("marionette", true);

    If you have set the driver path correctly in your path environment variable.

    0 讨论(0)
  • 2020-12-18 13:22

    I too got the "Entity Not Found" error using FirefoxDriver(new FirefoxOptions()). It appears to be looking for firefox.exe in C:\Program Files (x86)\Nightly and not finding it. I found this working :

    FirefoxDriverService service = FirefoxDriverService.CreateDefaultService();
    service.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
    IWebDriver driver = new FirefoxDriver(service);
    
    0 讨论(0)
  • 2020-12-18 13:28

    I try with this and it's working:

    1. Install FirefoxDevEdition
    2. Download geckodriver.exe

    FirefoxDriverService service = FirefoxDriverService.CreateDefaultService(@"C:\Users\jmalpartida\Downloads\geckodriver-v0.8.0-win32", "geckodriver.exe");
    service.Port = 64444;
    service.FirefoxBinaryPath = @"C:\Program Files (x86)\Firefox Developer Edition\firefox.exe";
    IWebDriver driver = new FirefoxDriver(service);
    
    0 讨论(0)
提交回复
热议问题