答案 0 :(得分:0)
c#中的一个例子如下:
driver.FindElement(By.XPath("//a[contains(@title, 'Candidate')]")).Click();
或者:
driver.FindElement(By.XPath("//a[contains(@href, '/candidate/search')]")).Click();
答案 1 :(得分:0)
亲爱的朋友,你可以采取以下答案的暗示..其中的链接是www.amazon.in
for(int i=1;i<=webTableRows.size();i+=2) {
ArrayList <WebElement> webTableCols = (ArrayList<WebElement>)driver.findElements(By.xpath(".//*[@id='navFooter']/div[4]/table/tbody/tr["+i+"]/td"));
System.out.println(webTableCols.size());
for (int j=1;j<=webTableCols.size();j+=2) {
if(i==3 && j==11) {
break;
}
WebElement strElement = driver.findElement(By.xpath(".//*[@id='navFooter']/div[4]/table/tbody/tr["+i+"]/td["+j+"]/a"));
if(strElement.isDisplayed()) {
String strData = strElement.getText();
String[] newString = strData.split("\n");
System.out.print(newString[0]);
}