Я получаю следующую ошибку
Просто чтобы добавить этот код работал хорошо раньше. Я ничего не изменил. Браузер Firefox открыт, но ничего не происходит. Я вижу веб-драйвер, написанный внизу справа.
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
Ошибка создания кода:
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();
}
}