The expected [Undefined object] undefined must be a string (IndexOutOfBounds)
I ran into an issue for sendkeys in Firefox, it throws the "Expected [Undefined object] undefined as string (IndexOutOfBounds)" exception.
I added the geckodriver path to the system variables to avoid posting the path in the code.
Firefox driver:
FirefoxProfile profile = new FirefoxProfile();
profile.SetPreference("browser.download.manager.alertOnEXEOpen", false);
profile.SetPreference("browser.helperApps.neverAsk.saveToDisk", "application/csv, text/csv, text/plain,application/octet-stream doc xls pdf txt");
profile.SetPreference("browser.download.manager.focusWhenStarting", false);
profile.SetPreference("browser.download.useDownloadDir", true);
profile.SetPreference("browser.helperApps.alwaysAsk.force", false);
profile.SetPreference("browser.download.manager.closeWhenDone", true);
profile.SetPreference("browser.download.manager.showAlertOnComplete", false);
profile.SetPreference("browser.download.manager.useWindow", false);
profile.SetPreference("services.sync.prefs.sync.browser.download.manager.showWhenStarting", false);
profile.SetPreference("pdfjs.disabled", true);
_driverInstance = new FirefoxDriver(profile);
StackTrace:
System.InvalidOperationException: Expected [object Undefined] undefined to be a string (IndexOutOfBounds)
Result StackTrace:
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.InternalExecute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebElement.Execute(String commandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebElement.SendKeys(String text)
at LoginPage.set_forgotPwdEmail(String value)
Every test file that has SendKeys () throws this error.
I read a few questions on SO and found out that this is a Firefox issue. Is there any work around until it is fixed.
Firefox version: 53.0 GeckoDriver: geckodriver-v0.15.0-win64 Selinium version: 3.3.0
+3
source to share
3 answers