selenium-google-code-issue-archive icon indicating copy to clipboard operation
selenium-google-code-issue-archive copied to clipboard

IE10 Select object can not select by text or by value.

Open lukeis opened this issue 8 years ago • 8 comments

Originally reported on Google Code with ID 7785

Select select = new Select(driver.findElement(By.id("ctl00_ContentPlaceHolder1_ddlClient")));
         select.selectByVisibleText("1107 local client update");

when I call select.selectByVisibleText, program throw a excpetion as below: 
   Exception in thread "main" org.openqa.selenium.WebDriverException: Cannot click
on option element. Executing JavaScript click function returned an unexpected error,
but no error could be returned from Internet Explorer's JavaScript engine. (WARNING:
The server did not provide any stacktrace information)
Command duration or timeout: 67 milliseconds
Build info: version: '2.42.0', revision: '5e82430', time: '2014-05-22 20:18:33'
System info: host: 'JIM-LI', ip: '10.152.86.15', os.name: 'Windows 7', os.arch: 'x86',
os.version: '6.1', java.version: '1.7.0_60'
Session ID: b7d8ac11-9861-496f-b186-6796cfa4c6c0
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0, ignoreZoomSetting=false,
enablePersistentHover=true, ie.ensureCleanSession=false, browserName=internet explorer,
enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss, version=10, ie.usePerProcessProxy=false,
cssSelectorsEnabled=true, ignoreProtectedModeSettings=false, requireWindowFocus=false,
handlesAlerts=true, initialBrowserUrl=http://localhost:9637/, ie.forceCreateProcessApi=false,
nativeEvents=true, browserAttachTimeout=0, ie.browserCommandLineSwitches=, takesScreenshot=true}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:596)
    at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
    at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:79)
    at org.openqa.selenium.support.ui.Select.setSelected(Select.java:318)
    at org.openqa.selenium.support.ui.Select.selectByVisibleText(Select.java:116)
    at Program.main(Program.java:44)


IE driver server Trace log is in attachment.

Selenium version: 2.42.0
OS: windows 7,32bit
Browser: IE
Browser version: 10


My code is :
         System.setProperty(
                "webdriver.ie.driver",
                "D:/selenium/driverserver/IEDriverServer.exe");
         WebDriver  driver = new InternetExplorerDriver();

     driver.get("http://127.0.0.1/hahah.html");

         WebElement element = driver.findElement(By.id("kw"));
         element.sendKeys("chesse");


         Select select = new Select(driver.findElement(By.id("ctl00_ContentPlaceHolder1_ddlClient")));
         select.selectByVisibleText("1107 local client update");

//        driver.quit();
        System.out.print("aaa");


My html is :
<html>
<body>
<select name="ctl00$ContentPlaceHolder1$ddlClient" id="ctl00_ContentPlaceHolder1_ddlClient"
>
        <option selected="selected" value="-1"> - Select - </option>
        <option value="27920">01_nonglobal_client_test</option>
        <option value="27916">01test_nonglobal_client</option>
        <option value="26308">1 YEAR &amp; MORE PRODUCTION</option>
        <option value="27631">1107 global client check</option>
        <option value="27633">1107 local client update</option>
        <option value="27634">1107 non client 007</option>
</select>       
<input type="text" id="kw"/>
</body>
</html>


Reported by gcyciopes on 2014-08-25 03:35:42


- _Attachment: [driverlog.txt](https://storage.googleapis.com/google-code-attachments/selenium/issue-7785/comment-0/driverlog.txt)_

lukeis avatar Mar 04 '16 08:03 lukeis

Reported by barancev on 2014-08-25 13:50:36

  • Labels added: Browser-IE

lukeis avatar Mar 04 '16 08:03 lukeis

FYI: I can't reproduce the issue. The scenario:

      DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
      capabilities.setCapability("platform", Platform.WIN8);
      capabilities.setCapability("version", "10");
      // Create the connection to Sauce Labs to run the tests
      WebDriver driver = new RemoteWebDriver(
              new URL("http://xxx:[email protected]:80/wd/hub"),
              capabilities);

      driver.get("http://fiddle.jshell.net/barancev/wcbx6nwn/show/light/");
      WebElement element = driver.findElement(By.id("kw"));
      element.sendKeys("chesse");
      Select select = new Select(driver.findElement(By.id("ctl00_ContentPlaceHolder1_ddlClient")));
      select.selectByVisibleText("1107 local client update");
      driver.quit();

The result:
https://saucelabs.com/tests/dcbb4c535838480fb2e93afcc6130ccf

Reported by barancev on 2014-08-30 16:16:15

lukeis avatar Mar 04 '16 08:03 lukeis

Hi, I do this without Remotewebdriver. I suspect the issue is about env. And I still
have this issue, could you please have try in my env. (Selenium version: 2.42.0
OS: windows 7,32bit
Browser: IE
Browser version: 10) 

Reported by gcyciopes on 2014-09-01 10:15:25

lukeis avatar Mar 04 '16 08:03 lukeis

Please run InternetExplorerDriver with additional options

InternetExplorerDriverService service = new InternetExplorerDriverService.Builder()
      .withLogLevel(InternetExplorerDriverLogLevel.TRACE)
      .withLogFile(new File("iedriver.log"))
      .build();
InternetExplorerDriver driver = new InternetExplorerDriver(service);

and send the result log file after the issue occurs.

Reported by barancev on 2014-09-14 17:25:30

  • Status changed: NeedsClarification

lukeis avatar Mar 04 '16 08:03 lukeis

Please find the log file for the issue.

Reported by hpuma.13oct on 2014-09-24 14:35:01


- _Attachment: [ieDriver32.log](https://storage.googleapis.com/google-code-attachments/selenium/issue-7785/comment-5/ieDriver32.log)_

lukeis avatar Mar 04 '16 08:03 lukeis

Is there any work-around to select combo box options in IE ?

Reported by live.sabhari on 2015-04-06 05:41:27

lukeis avatar Mar 04 '16 08:03 lukeis

Hi,

I am facing this same issue on ie11 and selenium 2.46

Env:
WIn 8.1
IE 11
enable protected mode setting is unchecked for all zones.

Error:
On using selectitembyIndex, I am getting the error
Cannot click on option element. Executing JavaScript click function returned an unexpected
error.

This is working fine on google chrome.

Any help would be appreciated

Reported by sanamsmail on 2015-07-30 05:50:59

lukeis avatar Mar 04 '16 08:03 lukeis

Reported by luke.semerau on 2015-09-17 17:47:05

  • Labels added: Restrict-AddIssueComment-Commit

lukeis avatar Mar 04 '16 08:03 lukeis