Skip to content
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

Finding element (singular) using xpath does not return single element results (Android) #3774

Closed
glorylo opened this issue Oct 6, 2014 · 16 comments
Labels
Android related to Android-native driver(s) Bug a problem that needs fixing
Milestone

Comments

@glorylo
Copy link

glorylo commented Oct 6, 2014

I tried doing a simple find element via xpath and a predicate of [1]. However I get back 3 elements so finding element does not evaluate the predicate correctly.. This is for android

screen shot 2014-10-06 at 11 59 19 am

@glorylo glorylo changed the title Finding element (singular) using xpath does not return single element results (Android Finding element (singular) using xpath does not return single element results (Android) Oct 6, 2014
@glorylo
Copy link
Author

glorylo commented Oct 6, 2014

Note I am using 1.3-beta build

@bootstraponline
Copy link
Member

Is this fix in the beta build?

@jlipps
Copy link
Member

jlipps commented Oct 6, 2014

@bootstraponline yes

@bootstraponline bootstraponline added Android related to Android-native driver(s) Bug a problem that needs fixing labels Oct 6, 2014
@glorylo
Copy link
Author

glorylo commented Oct 6, 2014

I just tried the same search on 1.2.0 and it works. So something has changed in 1.3.0-beta

@jlipps
Copy link
Member

jlipps commented Oct 6, 2014

can you try on 1.2.3?

@paymand
Copy link
Member

paymand commented Oct 7, 2014

@jlipps: I think you meant 1.2.4 ?

@jlipps
Copy link
Member

jlipps commented Oct 7, 2014

well at the time i wrote that 1.2.4 wasn't out yet, but yes now i mean 1.2.4 :-)

@glorylo
Copy link
Author

glorylo commented Oct 7, 2014

Sorry I'm stuck with "could not launch appium inspector" after trying to get 1.2.4 and it doesn't launch in 1.3.0-beta either. :( I wasn't able to do the same test.

@glorylo
Copy link
Author

glorylo commented Oct 7, 2014

Err...I don't know why the inspector is not launching... I want to retry the finds.

image

@glorylo
Copy link
Author

glorylo commented Oct 8, 2014

I don't know what was the inspector issue.. i did an Mac update and it resolve it. Weird!

And I can confirm it does not work on 1.2.4. (it works on 1.2.0)

@jlipps jlipps added this to the Appium 1.3.1 milestone Oct 8, 2014
@JessicaSachs
Copy link

Let me know what the status is on this -- I think I'm seeing similar things and can provide logs if needed,

@Jonahss
Copy link
Member

Jonahss commented Oct 9, 2014

I think there is a basic misunderstanding of how xpath works.
//android.widget.FrameLayout[1] does NOT mean "get the first FrameLayout node". It means "get all the FrameLayout nodes which are the first child of their parent".

If you want the first FrameLayout, this is the xpath expression you would use:
(//android.widget.FrameLayout)[1]

In which case, not a bug?

http://stackoverflow.com/questions/3674569/how-to-select-specified-node-within-xpath-node-sets-by-index-with-selenium

@glorylo
Copy link
Author

glorylo commented Oct 9, 2014

Thanks Jonah. The xpath used had a unintended intent to retrieve the element. There is still behavior difference from 1.2.4 vs 1.2.0 using that same xpath, so something is off. May likely be resolved once we know what the issue is.

@Jonahss
Copy link
Member

Jonahss commented Oct 9, 2014

We messed around with xpath implementation a bit around 1.2.0 to 1.2.3 I'm pretty sure, but it should be stable going forward :)

@0x1mason
Copy link

@Jonahss Can we close this?

@Jonahss Jonahss closed this as completed Oct 21, 2014
@lock
Copy link

lock bot commented May 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators May 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android related to Android-native driver(s) Bug a problem that needs fixing
Projects
None yet
Development

No branches or pull requests

7 participants