I'm trying to automate a Windows application GUI using Winium. The app is using both WPF windows and "Chrome Legacy Window" (Chromium) windows.
I'm using the tool "Automation Spy" to inspect the GUI elements' ids inside the WPF windows to use with Winium. Automation Spy can't inspect elements in the "Chrome Legacy Window" windows in the same manner that Winium can't access these elements.
"Chrome Legacy Window" is a WEB window, so it requires automation with Selenium.
How do I use Selenium to hook on a Chromium window, which is not a browser like Firefox, Chrome and similar?
"Remote Debugging Port" was the solution for my problem.
I added the "remote-debugging-port=XXXX" to my CEF (Chromium Embedded Framework) command:
https://blog.chromium.org/2011/05/remote-debugging-with-chrome-developer.html
This allowed me to see and manage my app's CEF windows through localhost:XXXX.
I used both Winium and Selenium to test my app.
Winium for all my WPF windows and selenium for all my CEF windows.
My GUI test starts with Winium Driver to open my app and navigate WPF windows.
Each time I need to debug a CEF window, I'm opening a Chrome Driver using selenium with the "remote-debugging-port" argument, which allows me to click elements inside that window. When I'm finish with this chromium window I'm closing the selenium driver and continues with Winium.
Use Selenium and Winium with IntelliJ IDEA
Selenium is a portable framework for testing and automating web applications.
Winium is a Selenium-based tool for testing and automating desktop applications on Windows.
In order to use these modules inside IntelliJ IDEA project, follow these steps:
Download selenium-server-standalone jar file (e.g. selenium-server-standalone-3.141.59.jar)
https://www.seleniumhq.org/download/
Download winium-webdriver jar file (e.g. winium-webdriver-0.1.0-1.jar)
http://central.maven.org/maven2/com/github/2gis/winium/winium-webdriver/0.1.0-1/
Add both jars to your project structure: File → Project Structure → Dependencies → +
Now all Selenium and Winium imports should work. For example:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.winium.DesktopOptions;
import org.openqa.selenium.winium.WiniumDriver;
import org.openqa.selenium.winium.WiniumDriverService;
Use ChromeDriver with Selenium
Follow these steps:
Install the Java JDK and add its bin directory to your system PATH
variable.
Create a directory that will contain all files. This tutorial uses c:\temp.
Download ChromeDriver and extract it (e.g. chromedriver_win32.zip provides chomedriver.exe)
https://sites.google.com/a/chromium.org/chromedriver/downloads
Download selenium-server-standalone-X.X.X-alpha-1.zip (e.g. selenium-server-standalone-4.0.0-alpha-1.zip)
http://selenium-release.storage.googleapis.com/index.html
Download a CEF binary distribution client from Cefbuilds and extract (e.g. cef_binary_76.1.13+gf19c584+chromium-76.0.3809.132_windows64.tar.bz2)
http://opensource.spotify.com/cefbuilds/index.html
Your directory structure should now look similar to this:
c:\temp\
cef_binary_3.2171.1979_windows32_client\
Release\
cefclient.exe (and other files)
chromedriver.exe
Example.java
selenium-server-standalone-2.44.0.jar
For more information you can read this wiki:
https://bitbucket.org/chromiumembedded/cef/wiki/UsingChromeDriver.md
Use WiniumDriver with Winium
Follow these steps:
Download the Winium.Desktop.Driver.zip and extract it to c:\temp
https://github.com/2gis/Winium.Desktop/releases
Java Code Example
Start a winium driver and open your app:
DesktopOptions desktopOption = new DesktopOptions();
desktopOption.setApplicationPath("Path_to_your_app.exe");
File drivePath = new File("C:\\temp\\Winium.Desktop.Driver.exe");
WiniumDriverService service = new WiniumDriverService.Builder().usingDriverExecutable(drivePath).usingPort(9999).withVerbose(true).withSilent(false).buildDesktopService();
service.start();
WiniumDriver winiumDriver = WiniumDriver(service, desktopOption);
Navigate and test WPF windows using winium. For example:
winiumDriver.findElement(By.id("someElementID")).click();
Create a ChromeOptions object which holds all needed selenium information such as chromium client and remote debugging port.
Make sure to change the "XXXX" port to your remote debugging port.
System.setProperty("webdriver.chrome.driver", "c:/temp/chromedriver.exe");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary("c:/temp/cef_binary_76.1.13+gf19c584+chromium-76.0.3809.132_windows64_client/Release/cefclient.exe");
chromeOptions.addArguments("remote-debugging-port=XXXX");
Open a chrome driver (selenium) using the chrome options object.
WebDriver seleniumDriver = ChromeDriver(chromeOptions);
Use element inside the chromium windows. For example:
seleniumWait.until(ExpectedConditions.visibilityOfElementLocated(By.className("someButtonClassName")));
seleniumDriver.findElement(By.className("someButtonClassName")).click();
When you're done with the CEF window, close selenium driver and continue with the winium driver:
seleniumDriver.quit();
winiumDriver.findElement(By.id("someElementID")).click();
Close main winium driver:
winiumDriver.quit();
Related
My current project is java selenium (with selenide framework) auto-tests with gradle and junit.
Now, I want to wrap my whole project to docker container, to make it possible to run it on other machines using only docker.
As I see it:
User run my docker image
Image have installed java + chrome + selenium + gradle
Project tests launched within container.
(optional) image shares test results outside image (or I can connect to container and take a look at them).
What am I suppose to do?
A saw a lot of tutorials about browsers in containers, selenoid, etc.(which is cool).
But I can't find a solution for my question.
Thanks!
Suggest to run tests as docker-compose multi-container application.
It will have 2 services in docker-compose as i see it:
browser - based on selenium Chrome browser image
tests - based on custom image extending java base image. Custom image Dockerfile should have gradle installed and tests jar file built in it.
Tests should drive Chrome browser using RemoteWebDriver initialized as below (note browser hostname where remote Chrome is listening).
public void createChromeDriverForRemote(){
WebDriver driver = new RemoteWebDriver("http://browser:4444/wd/hub", DesiredCapabilities.chrome());
}
See quick start here
What you need to do is:
Create a docker image that has Java, Chrome, selenium, gradle, junit, etc
Once you have the image, run it on your local on any port example: 4444
Switch to RemoteWebdriver
public static String remote_url_chrome = "http://localhost:4444/wd/hub";
ChromeOptions options = new ChromeOptions();
driver.set(new RemoteWebDriver(new URL(remote_url_chrome), options));
Run the test now
I have the below code in Selenium/Java test class. Now, this code I have pushed to GitHub.
Also, I have set up the Jenkins job to execute the same code (in the Jenkins job I have pointed the code to GitHub).
The Jenkins job is triggering fine and started executing the test, but throwing below error while opening the browser.
The test case is supposed to open the Firefox browser, but the Firefox browsing is not opening.
So, my question is, whether the below selenium code is correct if I want to execute the test case in Jenkins job (Jenkins server is running in Cento7.4 OS).
NOTE: In the same CentOS VM, I am able to execute the same (below) selenium code in eclipse and it's able to open the Firefox browser and open the URL without any issues.
The issue is coming only if I try to run the same code in the Jenkins server as a Jenkins job.
Selenium code
System.setProperty("webdriver.gecko.driver", "geckodriver");
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.addArguments("--display=0");
WebDriver driver = new FirefoxDriver(firefoxOptions);
driver.get("https://www.facebook.com");
Jenkins job output
Running TestSuite
Failed to open connection to "session" message bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
1597912923234 mozrunner::runner INFO Running command: "/bin/firefox" "-marionette" "--display=0" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofileFz0Zr2"
Failed to open connection to "session" message bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Running without a11y support!
Error: cannot open display: 0
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.972 sec <<< FAILURE!
Results :
Failed tests: loginTest4(com.training.browsers.LinuxTest): invalid argument: can't kill an exited process
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[ERROR] There are test failures.
xauth list output
[root#localhost ~]# xauth list
localhost.localdomain/unix:0 MIT-MAGIC-COOKIE-1 4eb74af687f2dbc022ef03617614456e
#ffff#6c6f63616c686f73742e6c6f63616c646f6d61696e#:0 MIT-MAGIC-COOKIE-1 4eb74af687f2dbc022ef03617614456e
You may want to look into setting up xvfb (https://centos.pkgs.org/7/centos-x86_64/xorg-x11-server-Xvfb-1.20.4-10.el7.x86_64.rpm.html). The problem is that your Jenkins server cannot open display 0 to run in. Notice the parameters being sent in to the firefox binary specifying display 0 in your firefoxOptions match the INFO log line for the binary execution. Assuming that you are running a headless server and this is why you get this error. The same is not the case when running locally.
With xvfb you should be able to specify a screen number and set your configurations accordingly or simply use xvfb-run.
The test case is supposed to open the Firefox browser, but the Firefox browsing is not opening.
To resolve this issue, use WebDriverManager to automate the management of the drivers (e.g. chromedriver, geckodriver, etc.) required by Selenium WebDriver.
To use WebDriverManager in a Maven project, add the following dependency in your pom.xml (Java 8 or upper required).
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>4.2.2</version>
</dependency>
Then simply add WebDriverManager.firefoxdriver().setup(); in your code as shown below:
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import io.github.bonigarcia.wdm.WebDriverManager;
WebDriverManager.firefoxdriver().setup();
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.addArguments("--display=0");
WebDriver driver = new FirefoxDriver(options);
See the basic examples of running JUnit 4 tests on Firefox and Chrome using WebDriverManager here.
--display=n
The phrase display is used to refer to collection of monitors that share a common keyboard and pointer e.g. mouse, tablet, etc. Most workstations tend to only have one keyboard, and therefore, only one display. Multi-user systems, frequently have several displays and each display on a machine is assigned a display number (beginning at 0) when the X server for that display is started. display:0 is usually the local display i.e. the main display of the computer.
Using Jenkins
When Jenkins executes the batch file, Jenkins slave runs as service in the background for every program it initiates. So normally you won't be able to visualize the Firefox browser spinning up but in the task manager you can see Jenkins opens several Firefox processes in background.
Solution
There are a couple of approaches to address this issue as follows:
If you are using Jenkins as a windows service you need to Allow service to interact with desktop. Steps:
In windows service select the service of Jenkins:
Open properties window of the Jenkins service -> Logon-> enable the checkbox Allow service to interact with desktop
In this approach autolaunch of dbus-daemon works when under an X11 session, else it is disabled because there's no way for different applications to establish a common instance of the dbus daemon.
You can find a relevant detailed discussion in Jenkins : Selenium GUI tests are not visible on Windows
The other approach would be to run Jenkins from command prompt as java -jar jenkins.war instead of the windows installer version.
Another approach will be to use RemoteWebDriver. From Jenkins, make sure there is a machine where the selenium tests can run. On this server you spin up the firefox browser.
You can find a relevant detailed discussion in How to launch chrome browser from Jenkins directly instead of using code in eclipse
An alternative would be to invoke firefox-headless browser by setting setHeadless as true through an instance of FirefoxOptions() class as follows:
FirefoxOptions options = new FirefoxOptions();
options.setHeadless(true);
WebDriver driver = new FirefoxDriver(options);
driver.get("https://www.google.com/");
You can find a relevant detailed discussion in How to make Firefox headless programmatically in Selenium with Python?
invalid argument: can't kill an exited process
This error is commonly observed in the two following cases:
When you are executing your tests as a root/admin user. It is recommended to execute your tests as a non-root/non-admin user.
When there is an incompatibility between the version of the binaries you are using.
You can find a detailed discussion in WebDriverException: Message: invalid argument: can't kill an exited process with GeckoDriver, Selenium and Python on RaspberryPi3
I'm attempting to use Bamboo's build and deployment capabilities to run Selenium Automated tests with my project.
We're currently using a Maven task to build and run regular JUNIT tests, and the plan is to use another Maven task to run the Selenium tests after the code has been successfully deployed to the server. At the moment, everything seems to run just fine locally, but when bamboo attempts to run the Selenium tests it seems to hang indefinitely. Unfortunately I don't have remote access to the server to watch it first hand, but I do know that it's a Microsoft server running with OS version: Windows 2012 R2 64-bit. I also know that the server is using java version "1.8.0_101", which is the same as my local setup. I've included a sample of the code I'm running below.
import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
public class SeleniumTestExample {
WebDriver driver;
#Before
public void setup(){
System.setProperty("webdriver.ie.driver", "src/test/resources/IEDriverServer32bit.exe");
DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
driver = new InternetExplorerDriver(null, ieCapabilities);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("https://google.com");
}
#Test
public void printPageTitle(){
System.out.println("Title of Page is: " + driver.getTitle());
driver.quit();
}
}
When run through Bamboo, the only output in the logs are the lines...
Started InternetExplorerDriver server (32-bit)
2.53.1.0
Listening on port 8080
Only local connections are allowed
CI or Bamboo server should be used for controlling your tests. You should not try to run your tests on a CI server. The issue you are having is probably because of that. Your are trying to use CI server as you local machine, which it will not respond the same way as your local. Instead you should use selenium grid in your setup to remotely connect to a machine by making use of hub and node. You may also have to use remote webdriver. Also have a look at this post
I've seen this using TeamCity, in this case the IE tells you that its executable will only accept connections from the local machine. According to Selenium org
The HTTP server started by the IEDriverServer.exe sets an access control list to only accept connections from the local machine, and disallows incoming connections from remote machines. At present, this cannot be changed without modifying the source code to the IEDriverServer.exe. To run the Internet Explorer driver on a remote machine, use the Java standalone remote server in connection with your language binding's equivalent of RemoteWebDriver.
So first run a chromedriver via passing through a param like so :
chromedriver --whitelisted-ips=""
This will basically whitelist all IP's, not always an ideal solution of course. But will show you that your tests can run on this CI configuration. Next thing to look for is your users privileges. Ask your admin to grant you more permissions in order to do your job. Keep in mind that IE's Protected mode may require some additional changes from your user. If none of this helps, consider Selenium grid with IE nodes.
Try to get rid of the line in the code:
System.setProperty("webdriver.ie.driver", "src/test/resources/IEDriverServer32bit.exe");
First of all, it tells where selenium should look for the webdriver for IE. Since the Bamboo server is a windows machine, you have to set it up with the absolute path of the file, like "C:\test\webdriver\IEDriverServer32bit.exe".
Secondly, the property could be set using environment variables of the Bamboo task.
Thirdly, if you want to define it on the fly, you can define the property in pom.xml as:
<webdriver.ie.driver.path>
C:\test\webdriver\IEDriverServer32bit.exe
</webdriver.ie.driver.path>
and use it in a system property with help of maven-surefire-plugin.
then you can run test with the command
mvn test -Dwebdriver.ie.driver.path=C:\test\webdriver\IEDriverServer32bit.exe
with whatever path you want.
i have a VPS with ubuntu 14.04 LTS and with the desktop package installed, that mean I can launch firefox from a ssh -X session.
To make tests, I launched from my server the selenium standalone server jar (selenium-server-standalone-3.0.0-beta3.jar)
After launching it, in another ssh session, i just enter python commands :
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
And after that, following the instructions from
http://selenium-python.readthedocs.io/getting-started.html#using-selenium-with-remote-webdriver, I enter :
driver = webdriver.Remote(
command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities=DesiredCapabilities.FIREFOX)
After 45sec, i have lots of errors in both server window and client window.
Here is the main error :
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: GDK_BACKEND does not match available displays
I saw some people with the same problem, but even with the latest java and selenium versions, i still got this issue.
Thank you in advance for your help
It seems you're trying selenium 3 with latest firefox version. To support latest firefox with selenium 3, need to download latest geckodriver executable from this link and extract it into you system at any location.
Now to run selenium-server-standalone-3.0.0-beta3.jar use below command :-
java -jar selenium-server-standalone-3.0.0-beta3.jar -Dwebdriver.gecko.driver = "path/to/downloaded geckodriver"
Now you need to set capability with marionette property to true to support latest firefox with selenium 3 as below :-
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
caps = DesiredCapabilities.FIREFOX
# Tell the Python bindings to use Marionette.
caps["marionette"] = True
driver = webdriver.Remote(command_executor = 'http://127.0.0.1:4444/wd/hub', desired_capabilities = caps)
Note :- For more information about marionette follow this Mozilla official page
I am getting error while using Firefox with WebDriver.
org.openqa.selenium.firefox.NotConnectedException: Unable to connect
to host 127.0.0.1 on port 7055 after 45000 ms.
Firefox version:47.0
Selenium:2.53.0
Windows 10 64 bit
Is anyone getting a similar issue or any idea what is the solution for this? It's working fine with Chrome but with Firefox none of the URLs are getting loaded.
Unfortunately Selenium WebDriver 2.53.0 is not compatible with Firefox 47.0. The WebDriver component which handles Firefox browsers (FirefoxDriver) will be discontinued. As of version 3.0, Selenium WebDriver will need the geckodriver binary to manage Firefox browsers. More info here and here.
Therefore, in order to use Firefox 47.0 as browser with Selenium WebDriver 2.53.0, you need to download the Firefox driver (which is a binary file called geckodriver as of version 0.8.0, and formerly wires) and export its absolute path to the variable webdriver.gecko.driver as a system property in your Java code:
System.setProperty("webdriver.gecko.driver", "/path/to/geckodriver");
Luckily, the library WebDriverManager can do this work for you, i.e. download the proper Marionette binary for your machine (Linux, Mac, or Windows) and export the value of the proper system property. To use this library, you need to include this dependency into your project:
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>5.1.0</version>
</dependency>
... and then execute this line in your program before using WebDriver:
WebDriverManager.firefoxdriver().setup();
A complete running example of a JUnit 4 test case using WebDriver could be as follows:
public class FirefoxTest {
protected WebDriver driver;
#BeforeClass
public static void setupClass() {
WebDriverManager.firefoxdriver().setup();
}
#Before
public void setupTest() {
driver = new FirefoxDriver();
}
#After
public void teardown() {
if (driver != null) {
driver.quit();
}
}
#Test
public void test() {
// Your test code here
}
}
Take into account that Marionette will be the only option for future (for WebDriver 3+ and Firefox 48+), but currently (version 0.9.0 at writing time) is not very stable. Take a look to the Marionette roadmap for further details.
UPDATE
Selenium WebDriver 2.53.1 has been released on 30th June 2016. FirefoxDriver is working again with Firefox 47.0.1 as browser.
Try using firefox 46.0.1. It best matches with Selenium 2.53
https://ftp.mozilla.org/pub/firefox/releases/46.0.1/win64/en-US/
I had the same issue and found out that you need to switch drivers because support was dropped. Instead of using the Firefox Driver, you need to use the Marionette Driver in order to run your tests. I am currently working through the setup myself and can post some suggested steps if you'd like when I have a working example.
Here are the steps I followed to get this working on my Java environment on Mac (worked for me in my Linux installations (Fedora, CentOS and Ubuntu) as well):
Download the nightly executable from the releases page
Unpack the archive
Create a directory for Marionette (i.e., mkdir -p /opt/marionette)
Move the unpacked executable file to the directory you made
Update your $PATH to include the executable (also, edit your .bash_profile if you want)
:bangbang: Make sure you chmod +x /opt/marionette/wires-x.x.x so that it is executable
In your launch, make sure you use the following code below (it is what I used on Mac)
Quick Note
Still not working as expected, but at least gets the browser launched now. Need to figure out why - right now it looks like I need to rewrite my tests to get it to work.
Java Snippet
WebDriver browser = new MarionetteDriver();
System.setProperty("webdriver.gecko.driver", "/opt/marionette/wires-0.7.1-OSX");
If you're on OSX using Homebrew, you can install old Firefox versions via brew cask:
brew tap goldcaddy77/firefox
brew cask install firefox-46 # or whatever version you want
After installing, you'll just need to rename your FF executable in the Applications directory to "Firefox".
More info can be found at the git repo homebrew-firefox. Props to smclernon for creating the original cask.
If you're on a Mac do brew install geckodriver and off you go!
In case anyone is wondering how to use Marionette in C#.
FirefoxProfile profile = new FirefoxProfile(); // Your custom profile
var service = FirefoxDriverService.CreateDefaultService("DirectoryContainingTheDriver", "geckodriver.exe");
// Set the binary path if you want to launch the release version of Firefox.
service.FirefoxBinaryPath = #"C:\Program Files\Mozilla Firefox\firefox.exe";
var option = new FirefoxProfileOptions(profile) { IsMarionette = true };
var driver = new FirefoxDriver(
service,
option,
TimeSpan.FromSeconds(30));
Overriding FirefoxOptions to provide the function to add additional capability and set Firefox profile because selenium v53 doesn't provide that function yet.
public class FirefoxProfileOptions : FirefoxOptions
{
private DesiredCapabilities _capabilities;
public FirefoxProfileOptions()
: base()
{
_capabilities = DesiredCapabilities.Firefox();
_capabilities.SetCapability("marionette", this.IsMarionette);
}
public FirefoxProfileOptions(FirefoxProfile profile)
: this()
{
_capabilities.SetCapability(FirefoxDriver.ProfileCapabilityName, profile.ToBase64String());
}
public override void AddAdditionalCapability(string capabilityName, object capabilityValue)
{
_capabilities.SetCapability(capabilityName, capabilityValue);
}
public override ICapabilities ToCapabilities()
{
return _capabilities;
}
}
Note: Launching with profile doesn't work with FF 47, it works with FF 50 Nightly.
However, we tried to convert our test to use Marionette, and it's just not viable at the moment because the implementation of the driver is either not completed or buggy. I'd suggest people downgrade their Firefox at this moment.
New Selenium libraries are now out, according to: https://github.com/SeleniumHQ/selenium/issues/2110
The download page http://www.seleniumhq.org/download/ seems not to be updated just yet, but by adding 1 to the minor version in the link, I could download the C# version: http://selenium-release.storage.googleapis.com/2.53/selenium-dotnet-2.53.1.zip
It works for me with Firefox 47.0.1.
As a side note, I was able build just the webdriver.xpi Firefox extension from the master branch in GitHub, by running ./go //javascript/firefox-driver:webdriver:run – which gave an error message but did build the build/javascript/firefox-driver/webdriver.xpi file, which I could rename (to avoid a name clash) and successfully load with the FirefoxProfile.AddExtension method. That was a reasonable workaround without having to rebuild the entire Selenium library.
Its a FF47 issue
https://github.com/SeleniumHQ/selenium/issues/2110
Please downgrade to FF 46 or below (or try out FF48 developer https://developer.mozilla.org/en-US/Firefox/Releases/48)
Instructions on how to downgrade:
https://www.liberiangeek.net/2012/04/how-to-install-previous-versions-of-firefox-in-ubuntu-12-04-precise-pangolin/
Or if you are on Mac, as suggested by someone else in this thread use brew.
Firefox 47.0 stopped working with Webdriver.
Easiest solution is to switch to Firefox 47.0.1 and Webdriver 2.53.1. This combination again works. In fact, restoring Webdriver compatibility was the main reason behind the 47.0.1 release, according to https://www.mozilla.org/en-US/firefox/47.0.1/releasenotes/.
You can try using this code,
private WebDriver driver;
System.setProperty("webdriver.firefox.marionette","Your path to driver/geckodriver.exe");
driver = new FirefoxDriver();
I upgraded to selenium 3.0.0 and Firefox version is 49.0.1
You can download geckodriver.exe from https://github.com/mozilla/geckodriver/releases
Make sure you download zip file only, geckodriver-v0.11.1-win64.zip file or win32 one as per your system and extract it in a folder.
Put the path for that folder in the "Your path to driver" quotes.Don't forget to put geckodriver.exe in the path.
I eventually installed an additional old version of Firefox (used for testing only) to resolve this, besides my regular (secure, up to date) latest Firefox installation.
This requires webdriver to know where it can find the Firefox binary, which can be set through the webdriver.firefox.bin property.
What worked for me (mac, maven, /tmp/ff46 as installation folder) is:
mvn -Dwebdriver.firefox.bin=/tmp/ff46/Firefox.app/Contents/MacOS/firefox-bin verify
To install an old version of Firefox in a dedicated folder, create the folder, open Finder in that folder, download the Firefox dmg, and drag it to that Finder.
Here's what the problem looked like in Wireshark
Just load up 2.53.1 and every thing will work.
As of September 2016
Firefox 48.0 and selenium==2.53.6 work fine without any errors
To upgrade firefox on Ubuntu 14.04 only
sudo apt-get update
sudo apt-get upgrade firefox
It seems to me that the best solution is to update to Selenium 3.0.0, download geckodriver.exe and use Firefox 47 or higher.
I changed Firefox initialization to:
string geckoPathTest = Path.Combine(Environment.CurrentDirectory, "TestFiles\\geckodriver.exe");
string geckoPath = Path.Combine(Environment.CurrentDirectory, "geckodriver.exe");
File.Copy(geckoPathTest, geckoPath);
Environment.SetEnvironmentVariable("webdriver.gecko.driver", geckoPath);
_firefoxDriver = new FirefoxDriver();
I can confirm that selenium 2.53.6 works with firefox 44 for me on ubuntu 15.