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
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.
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();
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
}
}