Webdriver C# - 首先点击第二个链接文本

时间:2015-06-23 08:09:55

标签: c# selenium webdriver

通过这一行,我点击了第一个文本,但是如何点击第二个确切文本?

driver.FindElement(By.PartialLinkText("Play")).Click();

1 个答案:

答案 0 :(得分:-1)

使用此:

  //get the list of elements which has same linkText
  List<IWebElement> list = driver.findElements(By.partialLinkText("Play"));

  //Click on each element by iterating the loop
  foreach (IWebElement element in all)
  {
       element.click();
  }