-
-
Notifications
You must be signed in to change notification settings - Fork 764
Widget is trying to be located by variable name #307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @fabianaapateanu Is your app native or hybrid? Is this native or HTML content? Also It is failed when you are trying to test app version for Android (I know that this question is silly, but I'm seeing iOSFindBy)? Have you read the text of this PR? Do you use exactly AndroidDriver? Is there your own subclass of the AppiumDriver? Can I take a look at full server output (gist)? |
Hi, I am using a native iOS & Android app. I use only native context. This happens when I run from iOS context, my driver is an instance of IODriver or AndroidDriver exactly, depending on the device I want to run the test. When I get back to the office I will upload full log for both cases:
And yes, I have read the documentation. I have 3 types of widgets in my code:
|
Yeah. It is ok. i'm waiting for your logs... |
Sorry for delay, updated gist |
Ok. It was difficult to read logs but I managed to do it :)
These strings were taken from files serveriOSLog.log and serverLog.log
This is iOS log. (!!!) It looks like you are trying to use Android widget-object against iOS app. It seems that this sample proofs my concerns: https://gist.github.com/fabianaapateanu/2566308f12437ccc7007#file-navigationdrawer-java-L2. Here is only AndroidFindBy How to resolve
@iOSFindBy(locator for ios)
@AndroidFindBy(locator for android)
public class NavigationDrawer extends Widget {
// ------------------------------------------------------------------------
// TYPES
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// STATIC FIELDS
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// STATIC INITIALIZERS
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// STATIC METHODS
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// FIELDS
// ------------------------------------------------------------------------
@iOSFindBy(locator for ios)
@AndroidFindBy(locator for android)
@CacheLookup
protected MobileElement mChartMenuItemTxtView;
@iOSFindBy(locator for ios)
@AndroidFindBy(locator for android)
@CacheLookup
protected MobileElement mLogbookMenuItemTxtView;
//and so on
public abstract class NavigationDrawer extends Widget { @AndroidFindBy(locator for android)
public class AndroidNavigationDrawer extends NavigationDrawer {
@AndroidFindBy(locator for android)
@CacheLookup
protected MobileElement mChartMenuItemTxtView;
@AndroidFindBy(locator for android)
@CacheLookup
protected MobileElement mLogbookMenuItemTxtView;
//and so on @iOSFindBy(locator for ios)
public class IOSNavigationDrawer extends NavigationDrawer {
@iOSFindBy(locator for ios)
@CacheLookup
protected MobileElement mChartMenuItemTxtView;
@iOSFindBy(locator for ios)
@CacheLookup
protected MobileElement mLogbookMenuItemTxtView;
//and so on and then @WithTimeout(time = 2, unit = TimeUnit.SECONDS)
@CacheLookup
@OverrideWidget(androidUIAutomator = AndroidNavigationDrawer.class,
iOSUIAutomation = IOSNavigationDrawer.class)
NavigationDrawer mNavigationDrawer; Please read this text again #267. Also you can take a look at current tests: https://github.com/appium/java-client/tree/master/src/test/java/io/appium/java_client/pagefactory_tests/widgets
It looks like you are using invalid ids for Android. I've read Android logs and seems that it couldn't find element by id="navigation_view". But I'm not sure. If it is true so please try with this id: |
@fabianaapateanu I've got some idea. What about Java client wiki? |
Hello @TikhomirovSergey, Many thanks for looking into this, your help is much appreciated. I was thinking that if I create a widget that uses only AndroidFindBy locator then this one will be searched only when in Android and when being in iOS that won't be searched at all. Actually that widget does not exist in the iOS version of the app. I will use the abstract implementation or something else, no worries there. What about the Java wiki? |
There are many cases such as yours that should be documented. I think it is not convinient to search in PR descriptions. So I want to aggregate info at WIKI. @fabianaapateanu |
Oh, ok I see, sure. |
Closed! |
The gist is here:
https://gist.github.com/fabianaapateanu/2566308f12437ccc7007
I have one widget that is trying to be located by variable name, when it should be located only by AndroidFindBy locator. This happens when I am debugging the test. There is a server log snippet in the gist that contains the logs for searching after variable name.
The text was updated successfully, but these errors were encountered: