ChromeOptions --headless has no effect in Selenium 3.5.3 - selenium

I am using selenium 3.5.3 in my automation tool and chrome driver version updated to 76. My issue is chrome option which i set is no effect.
I tried in windows 10 machine.
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless", "--disable-gpu", "--window-size=1366,768");
DesiredCapability chrome = new DesiredCapability().chrome();
chrome.setCapability(ChromeOptions.CAPABILITY, options);
driver = new ChromeDriver(chrome);
driver.get("https://bing.com");
driver.quit();
In the above piece of code i am trying to run in chrome headless. But it has no effect and browser is launching and shows an execution.
chrome headless was working fine with selenium 3.5.3 and chrome driver 2.46

Related

Selenium cucumber not running in headless mode

I have added all headless condition in code still while running i am getting chrome browser gets launched
I tried the below code and expected it should work
ChromeOptions options = new ChromeOptions();
// Set the "headless" flag
options.addArguments("--headless");
// Create a new ChromeDriver instance with the headless option
driver = new ChromeDriver(options);

which firefox version is compatible with selenium 3.5.0?

I tried with Selenium 3.5.3 GeckoDriver 0.19 Firefox 55 but getting below exception:
Error: org.openqa.selenium.WebDriverException: browser name not boolean
Code :
DesiredCapabilities cap = DesiredCapabilities.firefox();
WebDriver driver = null;
System.setProperty("webdriver.gecko.driver", "<path to gecko>\geckodriver.exe");
cap.setBrowserName("firefox");
URL sURL= null;
cap.setCapability("firefox_binary", "<FIREFOX_PATH>"));
//Grid
sURL = new URL("http://localhost:5555/wd/hub");
driver = new RemoteWebDriver(sURL, cap);
Also saw this thread https://seleniumhq.wordpress.com/2017/08/09/firefox-55-and-selenium-ide/ that selenium ide would not be supported anymore in Firefox 55. Whether selenium jar would be still supported?
It was a bad news for the tester community since Selenium IDE no long works from Firefox 55 onwards. Now you have 2 choices:
1- Try with previous version of firefox (Temporary solution)
2- Use Selenium IDE alternatives (Highly Recommended)
I recommend you to use Firefox 54.0 and geckodriver v0.18.0.
Actually this links regarding Selenium IDE. You can use firefox 55 also.

Use of Selenium 3.0 with Firefox V<47

Selenium3 supports executable geckodriver to launch Mozilla Firefox just like other drivers; but executable geckodriver is not compatible with Mozilla Firefox < v47.
So How can we achieve backward compatibility with browsers V<47 i,e how can we use firefox browsers V<47 with Selenium3.
Disable the geckodriver capabilities so that FirefoxDriver can be used.
System.setProperty("webdriver.gecko.driver", "path/to/geckodriver.exe");
DesiredCapabilities d = new DesiredCapabilities();
d.setCapability("marionette", false); // to disable marionette, by default true
WebDriver driver = new FirefoxDriver(d);
Little Background to geckodriver.exe and Firefox version support:
From geckodriver github page:
Firefox 47 is explicitly not supported
So, If you want to use <= Firefox 47 version, use Firefox driver but not geckodriver.
In case of selenium 2.53, you don't need to do any additional things (no need to setup geckodriver as selenium 2.53 uses Firefox driver by default).
In Selenium 3.0, we must set geckodriver path (as geckodriver is the default driver for Firefox in Selenium 3.0) using System.setProperty and set marionette to false, so geckodriver capabilities will be disabled and default Firefox driver is used.
References:
https://github.com/mozilla/geckodriver#supported-firefoxen
https://github.com/mozilla/geckodriver/issues/224
https://stackoverflow.com/a/40658421/2575259
You should use old FirefoxDriver, just make sure to set marionette on false if you are using RemoteDriver because I'm not sure is it enabled by default (caps.setCapability(FirefoxDriver.MARIONETTE, false);)
This driver doesn't need any .exe file, just import org.openqa.selenium.firefox.FirefoxDriver; in your code so you could use it.
driver = new FirefoxDriver();
or if you are using grid:
driver = RemoteWebDriver(url, DesiredCapabilities.firefox());

Unable to Execute Automation tests in opera browser

I try to use opera browser with selenium ,on running the scripts browser get launched but no tests are running in the browser instead a error popups. I am using operachromium driver with opera version 40
below is the code to create opera driver instance:
System.setProperty("os.name","windows");
System.setProperty("webdriver.chrome.driver", "path to operachromiumdriver");
driver = new ChromeDriver();
driver.get("http://google.com");
Can any one help me on this.

Firefox not working with selenium

I'm using firefox 41.0b1 and selenium standalone 2.53.1 .issue is firefox run in sometimes and not always.error is Unable to connect to host 127.0.0.1 on port 7056 after 45000 ms. Firefox console output: also I'm using testNG.hoping for a good solution
this combination of firefox and selenium won`t work.
you could try to upgrade your firefox to version 47.0.1 which works with selenium 2.53.1
Use gecokDriver instead of firefoxDriver it will work smoothly with any version of firefox.
Code will look like below, make sure to set appropriate path where your gecodriver.exe is located:
System.setProperty("webdriver.gecko.driver", System.getProperty("user.dir") + "/BrowserDrivers/geckodriver.exe");
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability("marionette", true);
WebDriver driver = new MarionetteDriver(cap);
driver.get("http://www.seleniumhq.org");
driver.quit();