java-client icon indicating copy to clipboard operation
java-client copied to clipboard

cannot import io.appium.java_client.MobileElement

Open ChristianErdtmann opened this issue 2 years ago • 10 comments

Hello, i trying to use appium for Android Studio.

I have downloaded the java-client-8.0.0.0 from https://appium.io/downloads.html added it to my lib folder in my project and added it as libary.

I can import other things over the import tag like "io.appium.java_client.MobileCommand" but if i write "io.appium.java_client." i missing the "MobileElement"

So i dont think that i have done something wrong by the import because i can import other classes form the java_client. So why i cant import MobileElement.

Can you tell me what i have to do. Did i miss something or is the MobileElement no longer named like this?

... But the Appium Inspector have generated Code with MobileElement.... so i think this class should be still available.

ChristianErdtmann avatar Mar 13 '22 08:03 ChristianErdtmann

I watched now in my donwload java-client 8.0.0.0.jar and there is no class for the MobileElement. What should i use instead and why does my Appium Inspector generates code with MobileElement if this class doesnt exists anymore.

I have the newest version from inspector and server.

ChristianErdtmann avatar Mar 13 '22 08:03 ChristianErdtmann

ok i have now read at https://github.com/appium/java-client/blob/master/docs/v7-to-v8-migration-guide.md#mobileelement that the MobileElement was removed. But how do i now initiate my Android driver?

AndroidDriver<WebElement> driver = new AndroidDriver<WebElement>(new URL("https://127.0.0.1:4723/wd/hub"),dc); is not working.

ChristianErdtmann avatar Mar 13 '22 09:03 ChristianErdtmann

Can i get somewhere the old version of java-client like 7.6 ? I would like the work with the old version while the Documentation and Appium inspector is updated to the new changes from 8.0.

ChristianErdtmann avatar Mar 13 '22 09:03 ChristianErdtmann

FYI @KazuCocoa @jlipps: the code generator in Appium Inspector should be updated for compatibility with Java Client v8

mykola-mokhnach avatar Mar 13 '22 12:03 mykola-mokhnach

Yes, the code is not for Java 8 yet. We had an issue: appium/appium-inspector#333

KazuCocoa avatar Mar 13 '22 18:03 KazuCocoa

Kazu, the issue which you pointed is different to what Mykola is asking. We need the inspector the generate Java test code as per Java-client version 8.0.0 changes.

saikrishna321 avatar Mar 14 '22 02:03 saikrishna321

ah, i see. I only saw "java 8" word.

We need to update https://github.com/appium/appium-inspector/blob/main/app/renderer/lib/client-frameworks/java.js properly. I've only updated python and ruby, which I knew necessary changes.

KazuCocoa avatar Mar 14 '22 03:03 KazuCocoa

@saikrishna321 or @SrinivasanTarget do you think one of you could do the inspector changes? i don't know what's different in appium java client 8

jlipps avatar Mar 14 '22 18:03 jlipps

@saikrishna321 or @SrinivasanTarget do you think one of you could do the inspector changes? i don't know what's different in appium java client 8

Sure will check over weekend

SrinivasanTarget avatar Mar 14 '22 18:03 SrinivasanTarget

@saikrishna321 or @SrinivasanTarget do you think one of you could do the inspector changes? i don't know what's different in appium java client 8

Should be nothing too complicated. Simply replace occurrences of MobileElement with WebElement. https://github.com/appium/java-client/blob/master/docs/v7-to-v8-migration-guide.md contains more detailed changelist, but I assume only this one really affects the code generator

mykola-mokhnach avatar Mar 14 '22 19:03 mykola-mokhnach

Hi ! i'm making test case in appium java and i'm facing this issue Cannot resolve symbol 'MobileElement'

Arifa105 avatar Sep 02 '22 11:09 Arifa105

Hi ! i'm making test case in appium java and i'm facing this issue Cannot resolve symbol 'MobileElement'

Mobile Element is removed from recent versions of Java client. Please check migration guide in Readme.

SrinivasanTarget avatar Sep 02 '22 17:09 SrinivasanTarget

Hi ! i'm making test case in appium java and i'm facing this issue Cannot resolve symbol 'MobileElement'

Mobile Element is removed from recent versions of Java client. Please check migration guide in Readme.

Then how do i now initiate my Android driver?

darsh1197 avatar Jul 10 '23 08:07 darsh1197