SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.5k stars 8.15k forks source link

[🐛 Bug]: SelectElement not working after updating selenium webdriver 4 and IEDriverServer 4 #10319

Closed shlokVK closed 2 years ago

shlokVK commented 2 years ago

What happened?

after updating selenium WebDriver (3.15 to 4.0.0) and IEDriver (3.150.1 to 4.0.0) getting below error while setting dropdown value, code was working properly with old selenium version (3): Error : 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

HTML :

C# code : public By countrySelector = By.Id("selCountry"); public string Country { set => new SelectElement(Driver.FindElement(countrySelector )).SelectByText(value); }

   Country= "India";

How can we reproduce the issue?

HTML : 
<TD vAlign=top><SELECT id=selCountry">
<OPTION selected value=0>None</OPTION> <OPTION value=1>India</OPTION></SELECT>
</TD>

 public By countrySelector = By.Id("selCountry");

        public string Country
        {
            set => new SelectElement(Driver.FindElement(countrySelector )).SelectByText(value);
        }

Country= "India";

Relevant log output

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

Operating System

Window server 2016

Selenium version

C# Selenium version 4 , IEDriver 4

What are the browser(s) and version(s) where you see this issue?

Internet Explorer 11

What are the browser driver(s) and version(s) where you see this issue?

IEDriver 4

Are you using Selenium Grid?

no