3

I am getting the following error

Just to add this code was working fine earlier. I havent changed anything. The firefox browser open but nothing happens. I can see webdriver written in bottom right.

Exception in thread "main" org.openqa.selenium.WebDriverException: java.net.SocketException: Connection reset
Build info: version: '2.4.0', revision: '13337', time: '2011-08-12 09:57:13'
System info: os.name: 'Windows Vista', os.arch: 'x86', os.version: '6.0', java.version: '1.7.0'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:404)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:106)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:89)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:127)
    at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:78)
    at org.openqa.selenium.example.GetAllOptionInDropdown.main(GetAllOptionInDropdown.java:13)
Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:130)
    at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:127)
    at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:233)
    at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:98)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:210)
    at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:271)
    at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:233)
    at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:209)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:292)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:126)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:483)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
    at org.openqa.selenium.remote.HttpCommandExecutor.fallBackExecute(HttpCommandExecutor.java:274)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:254)
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.execute(NewProfileExtensionConnection.java:125)
    at org.openqa.selenium.firefox.FirefoxDriver$LazyCommandExecutor.execute(FirefoxDriver.java:257)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:387)
    ... 5 more

Code Throwing Error:

   package org.openqa.selenium.example;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class GetAllOptionInDropdown  {
    public static void main(String[] args) {

        WebDriver driver = new FirefoxDriver();
        driver.get("http://www.google.co.in/advanced_search");

        List<WebElement> element = driver.findElements(By.xpath("//div/table[2]/tbody/tr[3]/td/select/option"));
        System.out.println("Total DropDown Options "+ element.size());
        for (WebElement webElement : element) {
            System.out.println(webElement.getText());       
        }

        driver.quit();
    }
}
6
  • Please show the code which is throwing this exception Commented Aug 22, 2011 at 12:15
  • Mike - I added code above and some additional information Commented Aug 22, 2011 at 14:25
  • Nope, that works just fine for me. Prints out 47 options. Commented Aug 22, 2011 at 15:23
  • i know the code is correct. it was working fine yesterday. but today, The firefox browser open but nothing happens. I can see webdriver written in bottom right. Commented Aug 22, 2011 at 15:52
  • Sorry I can't help since I am unable to reproduce it Commented Aug 22, 2011 at 15:55

2 Answers 2

2

I made a same mistake by thinking that 2.9 was the latest version. After updating the version 2.25 from 2.9 my coding is working fine. :)

Sign up to request clarification or add additional context in comments.

Comments

0

Try updating your gecko driver

I had the same problem using the chrome driver. It worked yesterday, today it didn't.

For reasons I don't understand, it worked after updating my chrome driver to the latest version. (2.25 instead of 2.9. Earlier I made the mistake of thinking 2.9 was the latest).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.