WebDriver with Java code DOES NOT open Firefox and does nothing in Windows XP

I am trying to run Selenium2 (known as WebDriver) with Java in Firefox. It does not even open Firefox and does not cause any errors in the console. He remains idle and does nothing.

I am using FF 13 beta Selenium WebDriver 2.23.1 (latest) Win XP

I also tried downgrading the FF version (changed to 9), it did not work, updated WebDriver to the latest (2.23.1) from 2.22, it did not work

When I run this code in InternetExplorer (8), it will open a browser, but will not identify any element, and the test will fail.

My code is:

public class Selenium2Example { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); } } 
+4
source share
4 answers

I have the same error. Windows + FF 14.0 and

 <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>2.21.0</version> </dependency> 

I debugged the code and I checked that Thread was stuck in the FirefoxBinary class, inside the method

  public void clean (FirefoxProfile profile, File profileDir) throws IOException

profile.isRunning (profileDir) always returns true ... why nothing happens ...

 if (Platform.getCurrent().is(Platform.WINDOWS)) { while (profile.isRunning(profileDir)) { sleep(500); } do { sleep(500); } while (profile.isRunning(profileDir)); }
if (Platform.getCurrent().is(Platform.WINDOWS)) { while (profile.isRunning(profileDir)) { sleep(500); } do { sleep(500); } while (profile.isRunning(profileDir)); } 

Then I upgraded to 2.25 and it will work!

 <dependency> <groupId>org.seleniumhq.selenium</groupId>] <artifactId>selenium-java</artifactId> <version>2.25.0</version> </dependency> 
+2
source

To open firefox, you have to use the selenium firefox driver.

Refer to this simple example at this link - 5 Minutes Getting Started Guide

Let me know if the Firefox browser opens after the firefox driver is initialized.

+1
source

Although this is an old post, but if someone would be looking for an answer, this helped me in a similar case:

 FirefoxProfile profile = new FirefoxProfile(); FirefoxBinary binary = new FirefoxBinary(@"path\to\firefox.exe"); FirefoxDriver driver = new FirefoxDriver(binary,profile); 
+1
source

You can use the code below to fix this problem: -

  System.setProperty("webdriver.firefox.bin", "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe"); FiewfoxDriver fdr = new FirefoxDriver(); 
0
source

All Articles