Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium WebDriver C# find element by href path

How I can click on

<a href="Vacancies.aspx?param=apply:16 " title="Please click to apply ">Apply</a>

I have a few Apply links on page. I should click on apply:16 (not apply:10,11,n).

I have a script (watir, ruby ) :

browser.link(:href, "Vacancies.aspx?param=apply:16").click

How its should be for Selenium WebDriver C# ?

I tried
driver.FindElement(By.LinkText("Apply")).Click(); But as you understood, this isnt work.

Thanks

like image 959
Yuri S Avatar asked Apr 25 '13 07:04

Yuri S


1 Answers

Give a try with below locator.

By.CssSelector("[href*='Vacancies.aspx?param=apply:16']")
like image 72
Santoshsarma Avatar answered Oct 10 '22 01:10

Santoshsarma