如何使用JAVA验证SeleniumWebDriver中是否启用了链接?
我想先验证是否启用了分页链接。如果是 已启用,然后单击链接,否则我不想单击 在JAVA中链接并跳过if条件 我正在使用SeleniumWeb驱动程序和TestNG 谢谢,如何使用JAVA验证SeleniumWebDriver中是否启用了链接?,selenium,webdriver,testng,Selenium,Webdriver,Testng,我想先验证是否启用了分页链接。如果是 已启用,然后单击链接,否则我不想单击 在JAVA中链接并跳过if条件 我正在使用SeleniumWeb驱动程序和TestNG 谢谢, Rishil Bhatt使用浏览器inspect元素的web控制台检查是否有任何属性可使用样式、类等禁用链接 String temp = selenium.getAttribute(locator@attribute); 现在您可以验证temp的值 请同时参考:使用isEditable(定位器),如果链接被禁用,将返回fa
Rishil Bhatt使用浏览器inspect元素的web控制台检查是否有任何属性可使用样式、类等禁用链接
String temp = selenium.getAttribute(locator@attribute);
现在您可以验证temp的值
请同时参考:使用isEditable(定位器),如果链接被禁用,将返回false,否则返回true
if(existsElement("test")==true){
WebElement menuHoverLink = driver.findElement(By.id("test"));
actions.moveToElement(menuHoverLink).perform();
Thread.sleep(6000);
}
else{
System.out.println("element not present -- so it entered the else loop");
}
然后在测试中调用该方法:
homePage.elementIsDisable(driver, By.id("acc-confirm"));
此检查是否禁用webElement当链接处于“启用”状态和“禁用”状态时,是否可以发布HTML代码。我试图理解你说“启用”是什么意思。通常它要么在那里,要么不在那里,你不能真正禁用它。
homePage.elementIsDisable(driver, By.id("acc-confirm"));