我正在尋找功能來尋找鏈接是否存在於網頁中。如果鏈接存在,則打印鏈接「鏈接找到!」。xpath可以用來從網站上搜索鏈接嗎?
例如:(我想找到XPATH 「123」)的 「href」 屬性
driver.findElement(By.xpath ("123"));
if (the xpath found the "123"){
System.out.printIn ("link found")
} else {
System.out.printIn ("missing link..")
}
是的,我使用硒webdriver .. 感謝您的解決方案! :d – sssheng