SeleniumHQ / selenium-google-code-issue-archive

Archive, please see main selenium repo
https://github.com/seleniumhq/selenium
345 stars 195 forks source link

java.lang.ClassCastException: org.openqa.selenium.android.AndroidWebElement cannot be cast to org.openqa.selenium.internal.WrapsElement #3992

Closed lukeis closed 8 years ago

lukeis commented 8 years ago

Originally reported on Google Code with ID 3992

Hi,
I'm running Junit test cases on android emulator with Eclips and Android webdriver
cannot catch the frame.

With trying the following code:

WebElement MNSAPIDashboard = driver.findElement(By.name("MNSAPIDashboard"));
        driver.switchTo().defaultContent();
        driver.switchTo().frame(MNSAPIDashboard);

 - Test always stopped in row with "driver.switchTo().frame(MNSAPIDashboard);" with
exception below:

java.lang.ClassCastException: org.openqa.selenium.android.AndroidWebElement cannot
be cast to org.openqa.selenium.internal.WrapsElement
at org.openqa.selenium.android.AndroidWebDriver$AndroidTargetLocator.frame(AndroidWebDriver.java:572)
at my.empty.project.test.SdkDemoTest.testSDKdemoprep(SdkDemoTest.java:41)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:545)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551)

in the referenced libraries I have:
android_webdriver_library.jar
selenium-java-2.22.0.jar
selenium-server-2.22.0.jar
selenium-server-standalone-2.22.0.jar
selenium-server-standalone-2.0b2.jar

OS:XPSP3
Android emulator 4.0.3

Could it be resolved in some way?
Thanks in advance.

Reported by Roman.Alyokhin on 2012-05-30 15:40:15

lukeis commented 8 years ago

Reported by barancev on 2012-05-31 03:09:45

lukeis commented 8 years ago
I get almost the same error every time I try to invoke the .isDisplayed() method on
an element. I'm using selenium-java-2.30.0.jar, android-server-2.21.0.apk and a Nexus
7 running Android 4.2

Reported by micsproul on 2013-02-26 05:19:54

lukeis commented 8 years ago
Yep, I still have same problem with 2.30 version using Samsung nexus i9250 with android
4.1.1.

Reported by Roman.Alyokhin on 2013-02-26 13:07:48

lukeis commented 8 years ago
I am also facing similar issue

Reported by sams.prashanth on 2013-04-09 15:02:25

lukeis commented 8 years ago
Selenium project no longer supports the AndroidDriver.

Please use Selendroid instead:
http://selendroid.io/webview.html

And log any issues against that project:
https://github.com/selendroid/selendroid/issues

Reported by luke.semerau on 2013-12-26 21:57:35

lukeis commented 8 years ago

Reported by luke.semerau on 2015-09-17 18:15:32