Please help in getting xpath

41 views
Skip to first unread message

Sumit Keswani

unread,
Jun 14, 2018, 2:57:02 PM6/14/18
to seleniu...@googlegroups.com
Hi Team,

How can I get xpath of first Free app under 'All extensions'
I need to click on first Free app(not paid one) to get into app details page

I dont want to use App name, and want to keep generic solution

Below is the site:

Regards,
Sumit 

Nagendra Kuppala

unread,
Jun 14, 2018, 3:15:18 PM6/14/18
to Selenium Users
Try below:

//*[@id="app-group-all-apps"]/div[2]/div/div/ul/li[3]/div[5][contains(string(), "Free")]  
or
//*[@id="app-group-all-apps"]/div[2]/div/div/ul/li[3]/div[5][contains(span/small/following-sibling::text(), "Free")] 

Change Text "Free" same as in HTML. may include spaces

Sumit Keswani

unread,
Jun 14, 2018, 3:29:44 PM6/14/18
to seleniu...@googlegroups.com
Thanks much Nagendra for your response

Actually I want to click on app title which has Free label 
Is there a way to get app xpath wrt to Free label

I can try to iterate over all Apps and click the app title which contains Free text 

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-users+unsubscribe@googlegroups.com.
To post to this group, send email to selenium-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/a32e2257-ae60-4ccf-8422-c99039c35636%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike Hetzer

unread,
Jun 15, 2018, 3:56:35 PM6/15/18
to Selenium Users
This was fun.

Use this relative xpath to find all links where the app says it's "Free":

//div[@id='app-group-all-apps']//li//div//span/small[contains(text(),'Free')]/ancestor::li//div[1]//a

Then just target the first WebElement in the list/collection.

total QA

unread,
Jun 19, 2018, 2:37:32 AM6/19/18
to Selenium Users
Hi,

for complete information on Xpath Axes locators refer to the link.


Regards,
Reply all
Reply to author
Forward
0 new messages