E
E
Elena2018-01-31 23:06:35
Python
Elena, 2018-01-31 23:06:35

How to find element and click on it using href for Selenium Python?

There is a web application https://creditcards.chase.com
You need to click on the Learn More button , but there were difficulties when working with WebDriver - all buttons on the current page have the same id [id="LearnMoreLink"] - the only parameter that distinguishes them
[href *="/cash-back-credit-cards/chase-freedom-unlimited"]
how to solve this problem.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
artem78, 2018-01-31
K

So what's the problem? Filter by id and url at once:

#LearnMore[href*="/cash-back-credit-cards/chase-freedom-unlimited"]

S
sim3x, 2018-01-31
@sim3x

https://devhints.io/xpath

a[href^='/']	//a[starts-with(@href, '/')]
a[href$='pdf']	//a[ends-with(@href, '.pdf')]	 
a[href~='://']	//a[contains(@href, '://')]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question