Firefox 47.0 to crash on startup selenium webdriver - selenium

Yesterday we updated Firefox 47.0 and selenium test script started getting crash,
Please see attached screenshot.
Firefox getting crash
as mentioned in Firefox release notes they suggested to use Marionette WebDriver . We have downloaded Marionette WebDriver for windows and as mentioned in link we made code changes by adding Marionette WebDriver in bin/debug folder.Below are code changes for same
var driver = new FirefoxDriver(new FirefoxOptions());
However we are facing issue "entity not found"
Note : We are using c# selenium WebDriver on Windows7 64 bit OS and We tired below solution such as
Renamed Marionette WebDriver to wires.exe
Add Marionette WebDriver exe path in Environment variable.
Use RemoteWebDriver as shown below
DesiredCapabilities capabilities = DesiredCapabilities.Firefox();
// Set Marionette on so the Grid will use this instead of normal FirefoxDriver
capabilities.SetCapability("marionette", true);
var driver = new RemoteWebDriver(capabilities);
Please somebody help in this issue.

Have the same issue, the problem is unclear for now, but this kind of situation was before, you just need to wait new selenium update or Firefox fix (depends who introduced this problem), for now you could revert to previous version of FireFox.
https://support.mozilla.org/en-US/kb/install-older-version-of-firefox
UPD: Now if you using Firefox 47 you need to use new FirefoxDriver(geckodriver),
Details could be found here:
https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver

You need to add wires.exe to your System Path, not bin/debug. The Mozilla marionette instruction page does not mention bin/debug at all. Also make sure the executable is present on the path for the system your grid hub and grid nodes are running on, not just the system where the tests are running.

Related

Getting Timed out receiving message from renderer: 600.000 When we execute selenium scripts using Jenkins windows service mode

We are executing our selenium automation script using jenkins window service(Headless mode) on daily basis .it was working fine till yesterday. suddenly it stopped working and not launching the browser. it shows the below error message [1553677874.187][SEVERE]: Timed out receiving message from renderer: 600.000. after that all the remaining test cases are getting failed.
It is working fine if we run the build using jenkins as without windows service. We are experiencing this issue only with windows as service
My chrome driver version :73.0.3683.68
Chrome browser version :73.0.3683.68
Selenium Version :3.14.0
I have tried to downgrade the browser version and driver version. even though it is not working
I am expecting the browser should launch in the background when we execute using jenkins as windows service but getting error message.
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("load-extension=C:\\1.13.4_0");
options.addArguments("--start-maximized");
options.addArguments("--ignore-certificate-errors");
options.addArguments("--disable-popup-blocking");
// options.addArguments("window-size=1400,600");
options.addArguments("enable-automation");
options.addArguments("--headless");
options.addArguments("--window-size=1920,1080");
options.addArguments("--no-sandbox");
// options.addArguments("--disable-extensions");
options.addArguments("--dns-prefetch-disable");
options.addArguments("--disable-gpu");
options.setPageLoadStrategy(PageLoadStrategy.NORMAL);
DesiredCapabilities capabilities =
DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY,
**strong text**options);
return new ChromeDriver(capabilities);
Seems you are using the following configuration:
chromedriver=73.0.3683.68
chrome=73.0.3683.68
Windows OS
John Chen (Owner - chromedriver) recently have confirmed that,
We have confirmed issues with take screenshot when Chrome 73.0.3686.75 is started by a service (such as Jenkins or Task scheduler) on Windows. Please see https://crbug.com/942023 for more details. We apologize for any inconvenience caused by this. However, we haven't yet been able to observe similar issue on Linux, so we appreciate any help you can provide to enable us to reproduce the issue on Linux. We don't have access to TeamCity, but we have tested take screenshot using Docker image produced by Selenium (selenium/standalone-chrome:3.141.59-lithium), and didn't find any problems.
Yesterday (Mar 26, 2019), John once again confirmed:
I am aware of some issues with running Chrome 73 from Jenkins. I don't know any workarounds. Please following https://crbug.com/942023 for updates.
Update
We were able to dig up the main issue. The main issue is not with ChromeDriver v73.x as such but with Chrome v73.x and John officially confirms it as:
The root cause is indeed in Chrome 73.x, not in ChromeDriver. We are working with Chrome devs to find a solution.
Solution
A quick fix solution will be to:
Downgrade Chrome Browser to Chrome v72.x
Use a matching ChromeDriver among:
ChromeDriver 2.46
ChromeDriver 72.0.3626.69
Note: If you are using Chrome version 72, please download ChromeDriver 2.46 or ChromeDriver 72.0.3626.69
Ensure that JDK is upgraded to recent level of JDK 8u202.
Outro
You can find the relevant discussions in:
Page.captureScreenshot no longer works in Chrome 73 under Selenium as a Service on Windows
Error [SEVERE]: Timed out receiving message from renderer: 20.000 while executing the testsuite through Selenium on Jenkins
Download Google Chrome 72 Offline Installer For All Operating Systems
Update(03-April-2019)
Adding the argument --disable-features=VizDisplayCompositor through an instance of ChromeOptions() seems solves the issue:
ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-features=VizDisplayCompositor");
WebDriver driver = new ChromeDriver(options);
driver.get("https://google.com");
Possible problem is that your Google Chrome updated and became incompatible with your Chromedriver. I suggest either getting a new Chromedriver or downgrading your Google Chrome to a previous version and disabling auto updates.
You can verify the required Chromedriver version for your Google Chrome here:
http://chromedriver.chromium.org/downloads
Step 4 of the following link worked for me to disable automatic google Chrome updates.
https://www.webnots.com/7-ways-to-disable-automatic-chrome-update-in-windows-and-mac/
Add below property(1) before ChromeDriver initialization
System.setProperty("webdriver.chrome.silentOutput", "true");
driver = new ChromeDriver();

chrome driver.manage().window().maximize() exception failed to change window state to maximized [duplicate]

The release notes for ChromeDriver 2.33 says that ""Fixes a bug which caused Resizing/Positioning Window commands to fail on Chrome 62+" however this still seems to be an issue when i am using Chrome 62+ browser. Maximizing chrome window using chrome driver results in below exception. Does anyone know a solution please?
Another thing i noticed is, though i installed latest chromedriver (v2.33) from https://chromedriver.storage.googleapis.com/index.html?path=2.33/, the log printed below says Driver info: chromedriver=2.25.426923 !!
Exception in thread "main" org.openqa.selenium.WebDriverException:
unknown error: cannot get automation extension from unknown error:
page could not be found:
chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
(Session info: chrome=62.0.3202.62) (Driver info:
chromedriver=2.25.426923
(0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT
10.0.15063 x86_64) (WARNING: The server did not provide any stacktrace information)
There are exactly 2 issues.
As you mentioned, you have installed latest chromedriver (v2.33) but the log printed below says Driver info: chromedriver=2.25.426923, this issue must be addressed first. You can consider to manually kill all the dangling chromedriver.exe tasks from the Task Manager. Additionally you can consider to use CCleaner to wipe out all the rotten OS stuffs from your system. Take a system reboot if required. Finally ensure that what ever the absolute location of chromedriver.exe you are using within System.setProperty() ensure that the chromedriver binary is of version 2.33.
Finally, it is suggested to use ChromeOptions class to maximize the Web Browser as follows:
System.setProperty("webdriver.chrome.driver", "C:\\your_directory\\chromedriver.exe");
ChromeOptions opt = new ChromeOptions();
opt.addArguments("disable-infobars");
opt.addArguments("--start-maximized");
opt.addArguments("--disable-extensions");
WebDriver driver = new ChromeDriver(opt);
driver.get("https://google.com");
Here are some of the alternatives which may solve your question:
Using maximize() from WebDriver.Window interface :
driver.manage().window().maximize();
Using setSize(Dimension targetSize) from WebDriver.Window interface:
driver.manage().window().setSize(new Dimension(800, 600));
Using addArguments("--start-maximized") through ChromeOptions:
chromeOptions.addArguments("--start-maximized");
Using addArguments("--window-size=1920,1080") through ChromeOptions:
chromeOptions.addArguments("--window-size=1920,1080");
Using executeScript() from JavaScriptExecutor interface:
((JavaScriptExecutor)driver).executeScript("window.resizeTo(1024, 768);");
You can find a related discussion in Chrome - org.openqa.selenium.WebDriverException: unknown error: cannot get automation extension at driver.manage().window().maximize();.
I believe there were some old chrome driver processes running in backend and same were being picked up when it was invoked via code. I deleted all processes instances, deleted old version of chrome driver, added the new 2.33 version and it worked. Thanks all for your suggestions.
I think the reason behind it may be your chrome version. Try again with updating your chrome browser. I have faced this type of issues for compatibility between chrome browser & the driver
Use class ChromeOptions.
System.setProperty("webdriver.chrome.driver", "h:\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("disable-infobars");
options.addArguments("--start-maximized");
WebDriver driver = new ChromeDriver(options);
driver.get(url);

Selenium, opening ff browser and automaticly close

Trying to run testng suite compiled jar on remote linux machine.
Problem I have is, if I run tests, FF open url I have defined and after that closing brower, and so on.
org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"name","selector":"username"}
Selenium 2.53.0
FF 45.0
Any idea why my test just open browser and close?
NoSuchElementException is thrown when element does not exist. It may not be the reason for fx crash.
The possibilities are :
Some where in the code you will be closing the driver.
I had faced the same issue earlier.
Try to upgrade your firefox to the latest version.
Try to set the firefox driver using setProperties
System.setProperty("webdriver.firefox.bin","C:\\Users\\AppData\\Local\\Mozilla Firefox\\firefox.exe");
WebDriver driver=new FirefoxDriver();
Follow the link to upgrade or downgrade fx: https://support.mozilla.org/t5/Install-and-Update/Install-an-older-version-of-Firefox/ta-p/1564
Below are some of the helpful links.
Firefox crashes when started by Selenium firefox driver
Which Firefox version is compatible with Selenium 2.53.0?
I was using wrong url without "/" on the end, after I changed all working now.

Exception while connecting with Chrome driver

How to use Chrome Driver in selenium project? Here am using latest version of Chrome Driver. My code looks like:
System.setProperty("webdriver.chrome.driver", C:\\Users\\....\\Downloads\\chromedriver_win32_2.3.zip\\chromedriver.exe");
In 64 bit Windows 7, however I am getting an exception.
org.openqa.selenium.WebDriverException: unknown error: unable to
discover open pages
I searched in google they provide the solution to replace the latest version of Chrome driver. I tried but not able to solve the issue.
chromedriver_win32 supports both 32-bit and 64-bit machines.
Use the latest chromedriver version; Download it from,
http://chromedriver.storage.googleapis.com/index.html?path=2.9/
And add the below snippet in your code
System.setProperty("webdriver.chrome.driver","C:\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
Can you unzip chromedriver_win32_2.3.zip file and then provide location of ChromeDriver inside unzipped folder ... This should help. Modified code should look like the following:
System.setProperty("webdriver.chrome.driver", "C:\Users\....\Downloads\chromedriver_win32_2.3\chromedriver.exe");

how to use different version of firefox using webdriver?

how to set Firefox version in web-driver?
I just want to user different version of Firefox.
like different version 19, 20 , 21....
please provide a generic solution which help for other browser also.
You have to install all the versions on your system. Then you can use the System property webdriver.firefox.bin to define the path for Firefox. Note than since the path is set through a System property, you will not be able to run two different Firefox in the same Java process.
This solution is specific to Firefox. There is no generic solution. You have to configure every WebDriver yourself.
More information about the configuration of Firefox Web Drvier.
Finally i have found solution to run with different browser version
System.setProperty("webdriver.firefox.bin", "/Applications/Firefox-2.app/Contents/MacOS/firefox-bin");
WebDriver driver = new FirefoxDriver();
driver.get(baseUrl);
System.out.println(driver.getTitle());
driver.close();
driver.quit();
I have found how to start a different FireFox browser (actually WaterFox) in Python Selenium, replacing
driver = webdriver.Firefox()
with
driver = webdriver.Firefox(firefox_binary = "/path/to/my/waterfox")
(Ubuntu 20.04, Python 3.95)