7

I am a newbie with webdriver and need some help..

I am using Selenium 2.2.0 with FF v7.0.1 on Windows XP

I've managed to record and play back a java script successfully in IE but whenever I try and execute the same script in FF, I get the following error message:

Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms

I've read at numbe of places that if I downgrade the firefox version to 3.6 script will work fine however I am not to keen on downgrading. Can someone please tell me what I am doing wrong?

package hisScripts;
import java.util.concurrent.TimeUnit;
import org.junit.*;
import static org.junit.Assert.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;


public class WebdriverTest_1 {
private WebDriver driver;
private String baseUrl;
private StringBuffer verificationErrors = new StringBuffer();
@Before
public void setUp() throws Exception {
    driver = new FirefoxDriver();
    //driver=new InternetExplorerDriver();
    baseUrl = "https://**********/";
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}

@Test
public void testUntitled() throws Exception {
    driver.get(baseUrl + "/");
    driver.findElement(By.xpath("//a[contains(text(),'my profile')]")).click();
    driver.findElement(By.xpath("//a[contains(text(),'about the service')]")).click();
    driver.findElement(By.xpath("//a[contains(text(),'contact us')]")).click();
    driver.findElement(By.xpath("//a[contains(text(),'help')]")).click();
    driver.findElement(By.xpath("//a[contains(text(),'home')]")).click();
    driver.findElement(By.xpath("//a[contains(text(),'logout')]")).click();

}

@After
public void tearDown() throws Exception {
    driver.quit();
    String verificationErrorString = verificationErrors.toString();
    if (!"".equals(verificationErrorString)) {
        fail(verificationErrorString);
    }
}

private boolean isElementPresent(By by) {
    try {
        driver.findElement(by);
        return true;
    } catch (NoSuchElementException e) {
        return false;
    }
}

}

user929258
  • 405
  • 2
  • 11
  • 16
  • 1
    The code is ok. What about upgrading? From FF7 to, say, FF9 or 10? Selenium can't work well with FF11 (so far), but the FF9 works fine! – Petr Janeček Apr 04 '12 at 15:47
  • @slanec - I've upgraed to FFv10.0.2 but still no joy - iS there anything else I could do to resolve this problem? – user929258 Apr 04 '12 at 16:50

2 Answers2

8

The selenium version you are using is extremely old. I don't think firefox 10 is supported in v2.2. The latest is 2.20.

Take a look at change log here. From the notes here native events in firefox 10 were supported starting from v2.19.0 that means you would need 2.19 or higher to support firefox 10.

nilesh
  • 14,131
  • 7
  • 65
  • 79
  • thanks for pointing that out.. It turned out to be silly mistake where I assumed selenium 2.2.0 is same as Selenium 2.20.0. To correct the problem I downloaded the latest 'Server' and 'Client drivers' (Java in my case) from http://seleniumhq.org/download/ and guess what it worked great :) – user929258 Apr 05 '12 at 08:48
  • In a Rails environment, this may mean upgrading the selenium-server jar used for running the remote server as well as upgrading the gem used by the server. I had the latter up-to-date but forgot that the former also needed upgrading. – river Jun 26 '12 at 15:04
  • I had a similar problem with version 2.24.X. So i changed to 2.25.0. Thank you. – dbalakirev Oct 13 '12 at 11:15
  • For firefox 29.0 i changed to selenium driver 2.39.0 – Huluvu424242 May 29 '14 at 17:57
-1

This problem is due to the compatibility of fire fox version and the selenium jar file version.Use the latest selenium jar files.that can fix the problem.

surag m
  • 1
  • 2