1

I did a google Search for the word 'Apple' using Selenium.

Using the below xpath i am trying to get hyperlinks only if the search results that has the word 'Cupertino' in it. But it does return nothing!

//a[contains(.,'Apple') and //span/em[contains(.,'Cupertino')]]

Google Search Results Screenshot:

enter image description here

Can someone help me out with correcting the Xpath i used?

1 Answer 1

1

Try below XPath

//h3[contains(.,'Apple') and following-sibling::div[contains(.,'Cupertino')]]/a
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.