I / O exception and cannot find element in IE using Selenium Webdriver

The code below works fine with Firefox and chrome, but shows errors when launched in IE.

System.setProperty("webdriver.ie.driver", "G:\\Selenium\\IEDriver\\IEDriverServer.exe");
    WebDriver driver=new InternetExplorerDriver();
    driver.get("https://www.google.co.in/?gws_rd=cr&ei=ZDziUrLDEuLpiAeD44H4BA");
    driver.findElement(By.name("q")).sendKeys("Selenium");

Error displayed: I/O exception (java.net.SocketException) caught when processing request: Software caused connection abort: recv failed Jan 24, 2014 3:44:04 PM org.apache.http.impl.client.DefaultRequestDirector tryExecute INFO: Retrying request Exception in thread "main" org.openqa.selenium.NoSuchElementException:

+2
source share
4 answers

Python ( Java):

from selenium import webdriver

def findElement(browser):
    browser.get("https://www.google.co.in/?gws_rd=cr&ei=ZDziUrLDEuLpiAeD44H4BA")
    element = browser.find_element_by_name("q")
    return element.get_attribute("outerHTML")

ieBrowser = webdriver.Ie()
print "IE: "+findElement(ieBrowser)

ffBrowser = webdriver.Firefox(firefox_profile=webdriver.FirefoxProfile())
print "FF: "+findElement(ffBrowser)

:

IE: <input id="lst-ib" class="lst lst-tbb" title="חיפוש" name="q" maxLength="2048" value="" size="41" type="text" autocomplete="off">

FF: <input spellcheck="false" dir="ltr" style="border: medium none; padding: 0px; margin: 0px; height: auto; width: 100%; background: url(&quot;data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw%3D%3D&quot;) repeat scroll 0% 0% transparent; position: absolute; z-index: 6; left: 0px; outline: medium none;" id="gbqfq" class="gbqfif" name="q" autocomplete="off" value="" type="text">

, , ( Selenium v2.39.00).

0

, ,

new WebDriverWait(driver,60).until(ExpectedConditions.visibilityOfElementLocated(By.id("gbqfq"))).sendKeys("Selenium");
0

(, , , ) .

0

All Articles