You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PageObjects gets elements API instead of element API #549
@HowToUseLocators(androidAutomation = CHAIN)
@AndroidFindBySet({
@AndroidFindBy(xpath = "(.//*[@resource-id='org.wordpress.android:id/note_content_container'])[position()=2]"),
@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"org.wordpress.android:id/note_subject\")")
}) //gets the third text from the note_subject view
Does not work
@HowToUseLocators(androidAutomation = CHAIN)
@AndroidFindBySet({
@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"org.wordpress.android:id/note_content_container\").enabled(true).instance(2)"),
@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"org.wordpress.android:id/note_subject\")")
}) //return the first text from the view
@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"org.wordpress.android:id/note_content_container\").enabled(true).instance(2)"),
@AndroidFindBy(uiAutomator = "new UiSelector().resourceId(\"org.wordpress.android:id/note_subject\")")
public MobileElement getNotification;
myself and @SrinivasanTarget are looking at it, if we break through will send a PR
Ok.
But please keep it in mind that it should be NowSuchElementException-safe till waiting time is expired.
Also please take a look at these classes from Selenium: ByAll ByChained
Activity
TikhomirovSergey commentedon Dec 30, 2016
@saikrishna321
Please remove
@AndroidFindBySetand check the result and use only AndroidFindBy :)saikrishna321 commentedon Dec 30, 2016
@TikhomirovSergey giving it a try now.. What does @AndroidFindBySet do ?
TikhomirovSergey commentedon Dec 30, 2016
It makes AndroidFindBy repeatable.
http://docs.oracle.com/javase/tutorial/java/annotations/repeating.html
saikrishna321 commentedon Dec 30, 2016
@TikhomirovSergey still the same, it just gets the default first locator's text value
saikrishna321 commentedon Dec 30, 2016
https://gist.github.com/anonymous/cc08201899d52d47322604d3954817a3
TikhomirovSergey commentedon Dec 30, 2016
@saikrishna321
https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/pagefactory/AndroidFindBy.java#L34
Also if it is the chain by default you may not define
@HowToUseLocators(androidAutomation = CHAIN)Please take a look at the updated WIKI chapter
TikhomirovSergey commentedon Dec 30, 2016
@saikrishna321
What happens when you try to
?
saikrishna321 commentedon Dec 30, 2016
With this as well the logs are same.
Here it picks the command with instance(3) https://gist.github.com/anonymous/cc08201899d52d47322604d3954817a3#file-updated-gist-with-androidfindby-L1132
and still looks for all elements
https://gist.github.com/anonymous/cc08201899d52d47322604d3954817a3#file-updated-gist-with-androidfindby-L1148-L1161
It gives the Text at the Third view which is expected :)
TikhomirovSergey commentedon Dec 30, 2016
So does this code works well
?
Ok. Has the same happened before (v<5.0.0-BETAx)? If there is a client bug then it may be the old problem that should be fixed
saikrishna321 commentedon Dec 30, 2016
@TikhomirovSergey
This works
https://gist.github.com/saikrishna321/a156e5c88a9787c0794bca7646ec47cf
Yah, i just tried with 4.1.2 and its the same. Chaining with unique ID's works, but with uiAutomation does not. Looks like we need to fix
TikhomirovSergey commentedon Dec 30, 2016
Yep. I will try to search for the root cause on the 1 Jan. For now please use xpath instead.
saikrishna321 commentedon Dec 30, 2016
Cheers, this is required for the appium workshop(http://thoughtworks-bangalore.github.io/vodQA-Shots/) so will wait for the fix
TikhomirovSergey commentedon Dec 30, 2016
@saikrishna321
... and for your case it is enough
saikrishna321 commentedon Dec 30, 2016
@TikhomirovSergey its calling elements instead of element api, can you please help in pointing where we call this api
https://gist.github.com/anonymous/cc08201899d52d47322604d3954817a3#file-updated-gist-with-androidfindby-L1132
TikhomirovSergey commentedon Dec 30, 2016
yes.
It is here
https://github.com/appium/java-client/blob/master/src/main/java/io/appium/java_client/pagefactory/AppiumElementLocator.java#L157
I really think that root cause is here. But I can check it only tomorrow or on the 1 Jan.
saikrishna321 commentedon Dec 30, 2016
myself and @SrinivasanTarget are looking at it, if we break through will send a PR
TikhomirovSergey commentedon Dec 30, 2016
@saikrishna321
There were few reasons why it was designed that way. But I think it is outdated implementation for now.
TikhomirovSergey commentedon Dec 30, 2016
@saikrishna321
Ok.
But please keep it in mind that it should be NowSuchElementException-safe till waiting time is expired.
Also please take a look at these classes from Selenium:
ByAll
ByChained
Could you please try this
using your AndroidUIAtomator locators?
[-]PageObjects not working on uiAutomation selector[/-][+]PageObjects gets elements API instead of element API[/+]Merge pull request #551 from TikhomirovSergey/master