问题
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 trieddriver.FindElement(By.LinkText("Apply")).Click();
But as you understood, this isnt work.
Thanks
回答1:
Give a try with below locator.
By.CssSelector("[href*='Vacancies.aspx?param=apply:16']")
回答2:
Just as a tidy up to Santoshsarma's work!
def <yourbutton> = driver.findElement(By.cssSelector("[href*='Vacancies.aspx?param=apply:16']"))
来源:https://stackoverflow.com/questions/16208925/selenium-webdriver-c-sharp-find-element-by-href-path