IEDriver, new Select(element) throws UnexpectedJavascriptExecutionException

8 views
Skip to first unread message

Aaron

unread,
Aug 5, 2010, 11:07:49 AM8/5/10
to webdriver
Hey all,
I am new and have run into an issue that I can't figure out. I have a
simple method that needs to return the options from a select list. It
seems simple. However the piece of code that instantiates the new
Select object is throwing an UnexpectedJavascriptExecutionException.
Here is the code and the exception

(Note: In case anyone else runs into this, until this gets fixed,
instead of passing your element to the new Select() method, I am using
the element.getText(), which return a space separated String of the
options. Not as graceful or clean as using the built in methods, but
since they aren't working for it, it will have to work)

private List<WebElement> getLanaguageSelectList(){
WebElement element =
driver.findElement(By.id(page.LANGUAGE_SELECTOR));
Select mySelect = new Select(element);
return mySelect.getOptions();
}

java.lang.IllegalStateException: get attribute of (13)
at
org.openqa.selenium.ie.ErrorHandler.verifyErrorCode(ErrorHandler.java:
90)
at
org.openqa.selenium.ie.InternetExplorerElement.getAttribute(InternetExplorerElement.java:
80)
at
org.ldsics.estore.fixtures.FooterFixture.getLanaguageSelectList(FooterFixture.java:
83)
at
org.ldsics.estore.fixtures.FooterFixture.getLanguageOptionsAsString(FooterFixture.java:
102)
at
org.ldsics.estore.testsuites.Store.StoreLanguageAvailabilitySuite.verifyLanguage(StoreLanguageAvailabilitySuite.java:
117)
at
org.ldsics.estore.testsuites.Store.StoreLanguageAvailabilitySuite.TestStoreLanguageListGroup(StoreLanguageAvailabilitySuite.java:
109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:
640)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:611)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:782)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1085)
at
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:
137)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:
121)
at org.testng.TestRunner.runWorkers(TestRunner.java:1010)
at org.testng.TestRunner.privateRun(TestRunner.java:684)
at org.testng.TestRunner.run(TestRunner.java:554)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:311)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:306)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:268)
at org.testng.SuiteRunner.run(SuiteRunner.java:217)
at org.testng.TestNG.runSuite(TestNG.java:1062)
at org.testng.TestNG.runSuitesLocally(TestNG.java:956)
at org.testng.TestNG.run(TestNG.java:874)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:75)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:127)
Reply all
Reply to author
Forward
0 new messages