Exception in thread “main” org.openqa.selenium.WebDriverException: Timed out waiting 45 seconds for Firefox to start after geckodriver upgradation

前端 未结 2 849
时光说笑
时光说笑 2021-01-20 22:12

I have written the below code in java to just open the firefox and redirect to gmail.com link, but seems its getting timed out before redirection. I have checked for the sol

相关标签:
2条回答
  • 2021-01-20 23:01

    As you are working with Selenium v3.12.0, GeckoDriver is v0.20.1 and Firefox v60.0.2 you have to mandatorily use marionette which is the default configuration. As you have forcefully set marionette to false so you see the error as:

    org.openqa.selenium.WebDriverException: Timed out waiting 45 seconds for Firefox to start.
    

    Solution:

    There are 2 ways to address your issue as follows:

    • Either use the default configuration (marionette set as true) as follows:

      System.setProperty("webdriver.gecko.driver", "C:\Users\MI SERVICE\Downloads\geckodriver.exe");
      WebDriver driver = new FirefoxDriver();
      driver.navigate().to("https://www.gmail.com");
      driver.quit();
      
    • Or you can explicitly set marionette to true as follows:

      System.setProperty("webdriver.gecko.driver", "C:\Users\MI SERVICE\Downloads\geckodriver.exe");
      FirefoxOptions capa = new FirefoxOptions();
      capa.setCapability("marionette", true);
      WebDriver driver = new FirefoxDriver(capa);
      driver.navigate().to("https://www.gmail.com");
      driver.quit();
      
    0 讨论(0)
  • 2021-01-20 23:10

    I haved this error for 2 days, the solution for me was in Set.Plataform put Platafor.ANY or Plataform.Windows because Plataform.WIN10 not worked, marionette wasn't necessary and I added and neether works, only works this. I hope this helps someone else:

    public class Main {
        public static RemoteWebDriver driver;
    
        public static void main(String[] args) throws MalformedURLException {
            System.setProperty("webdriver.gecko.driver", "D:/Lib/geckodriver.exe");
            DesiredCapabilities desiredCapabilities = new DesiredCapabilities().firefox();
            desiredCapabilities.setPlatform(Platform.ANY);
            desiredCapabilities.setBrowserName("firefox");
    
            driver = new RemoteWebDriver(new URL("http://172.20.19.182:5557/wd/hub"), desiredCapabilities);
            driver.navigate().to("http://www.google.com");
            driver.findElementByName("q").sendKeys("execute automation");
            driver.findElementByName("q").sendKeys(Keys.ENTER);
            driver.close();
            // write your code here
        }
    }
    
    0 讨论(0)
提交回复
热议问题