0

Once I obtain an href through the use of Selenium in Python.

Is there a way to find the XPath based on that href and click on that XPath?

For Example:

href = '/sweatshirts/vct65b9ze/yn2gxohw4' 

How would I find the XPath on that page?

1

1 Answer 1

2

When the element is for instance a link, you can use the following code:

     driver.find_element_by_xpath('//a[@href="/sweatshirts/vct65b9ze/yn2gxohw4"]');
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.