Selenium SendKeys() returned Expected [object Undefined] undefined to be a string (IndexOutOfBounds)

683 views
Skip to first unread message

tung...@gmail.com

unread,
Apr 24, 2017, 10:26:40 AM4/24/17
to Selenium Users
Hi all,

I had some test scripts running well with Selenium WebDriver 2.53.1 and Firefox 44.0.b2. However, because our web application no longer supports that Firefox version, we have to upgrade to use Selenium WebDriver 3.3.0, Gecko Driver 0.15 and Firefox 53.0, then most the tests got failed with the exception below:

System.InvalidOperationException was unhandled by user code
  HResult=-2146233079
  Message=Expected [object Undefined] undefined to be a string (IndexOutOfBounds)
  Source=WebDriver
  StackTrace:
       at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
       at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
       at OpenQA.Selenium.Remote.RemoteWebElement.SendKeys(String text)


Tried with the simple test below got the same exception when it tried to send keys to searchBox:

        [Test]
        public void TEST()
        {
            System.Environment.SetEnvironmentVariable("webdriver.gecko.driver", @"C:\EPi\Automation\Development\EPiServer.Automation.Commerce\bin\geckodriver.exe");
            var driver = new FirefoxDriver();
            driver.GoTo("https://www.google.com.vn");
            var searchBox = driver.FindElementByCssSelector("#lst-ib");
            searchBox.SendKeys("test");
        }

Anyone can help? Note that all tests ran ok with Selenium WebDriver 3.3.0 and ChromeDriver 2.29.

Thanks,

Tung

Anish Pillai

unread,
Apr 25, 2017, 8:59:07 PM4/25/17
to Selenium Users
Hi,

GeckoDriver 16 has a fix for this. But you would also need to upgrade Selenium to 3.4.


Cheers, Anish
AutomationTestingHub


Reply all
Reply to author
Forward
0 new messages