Unable to Execute Automation tests in opera browser - selenium

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.

Related

ChromeOptions --headless has no effect in Selenium 3.5.3

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

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.

Selenium FindElement and Chrome in Headless mode

After starting chromedriver.exe in headless mode following this advice and using just these arguments
options.AddArgument("headless");
options.AddArgument("window-size=1280,960");
The chromedriver opens invisibly. But Selenium's FindElement() command is not finding anything on the headless Chrome page. Instead it throws this exception:
An exception of type 'OpenQA.Selenium.NoSuchElementException' occurred in WebDriver.dll but was not handled in user code
Additional information: no such element: Unable to locate element:
Q1: Has anyone had success running Selenium commands in Chrome's headless mode?
Q2: Have you been able to use FindElement with a chromedriver running in headless mode? If yes, how did you do it?
After reading more, perhaps something along these lines may be necessary? Add this to the Chrome startup options and then maybe connect chromedriver to it?
"remote-debugging-port=9222"
But with that option the IWebDriver and chromedriver does not open.
Background info: to answer, why would you want to do this? The primary reason was for tests run as a part of CI. These are tests that run on a VM and may not support 1080p monitors. If we ran it in headless mode and set the resolution that way we could.
Add below lines of code in your main class:
ChromeOptions options = new ChromeOptions();
options.setHeadless(true);
options.addArguments("--window-size=1920,1080");
options.addArguments("--disable-gpu");
options.addArguments("--disable-extensions"); options.setExperimentalOption("useAutomationExtension", false); options.addArguments("--proxy-server='direct://'");
options.addArguments("--proxy-bypass-list=*");
options.addArguments("--start-maximized");
options.addArguments("--headless");
WebDriver driver = new ChromeDriver(options);

How to run chrome driver in headless mode or in background

I've been using chrome driver (with selenium webdriver), so far it never caused any issue, now for some requirement i want to run test cases in background. How can I do this?
Currently Chrome 59 supports headless mode.
You just need to use those chromeOptions to use headless chrome in selenium.
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("--disable-gpu");
You can refer below link for more details:
https://www.automation99.com/2017/07/how-to-use-chrome-headless-using.html
According to this post Any way to start Google Chrome in headless mode?, a new flag --headless is available in Chromium but Selenium is still to catch up as far as my limited googling skills tell me.
In the mean time you can explore HTMLUnitDriver for headless testing.
WebDriver driver = new HtmlUnitDriver((BrowserVersion.CHROME), true);

Does browser support WebDriver or does WebDriver support browser

Is it the browser job to support WebDriver or is it WebDriver job to support each browser?
I mean if there is a new release of Chrome does this mean that WebDriver works right away because the support is included in the new Chrome release?
Or is WebDriver support added later by the developers of WebDriver?
To run selenium webdriver in Chrome browser, we need to take the help of ChromeDriver which is a separate executable that selenium webdriver uses to control chrome. ChromeDriver is supported by the Chromium team, ChromeDriver is a standalone server which implements WebDriver's wire protocol for Chromium.
http://www.seleniumeasy.com/selenium-tutorials/how-to-run-webdriver-in-chrome-browser
Yes, Webdriver made changes later that's the reason new jars of selenium launches so rapidly.
Hope it will help you :)