[英]How do I check the value of the attribute aria-disabled as true or false in Krypton using Selenium and Java?
I tried:我试过:
ExpectedConditions.presenceOfElementLocated(By.cssSelector("[id='StandardSave'][aria-disabled='true']"
but still won't work.但仍然无法正常工作。
To check the value of the attribute aria-disabled you you have to induce WebDriverWait for the visibilityOfElementLocated()
and you can use either of the following Locator Strategies :要检查属性aria-disabled的值,您必须为visibilityOfElementLocated()
引入WebDriverWait ,您可以使用以下任一定位器策略:
Using id
:使用id
:
System.out.println(new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.id("StandardSave"))).getAttribute("aria-disabled"));
Using cssSelector
:使用cssSelector
:
System.out.println(new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#StandardSave"))).getAttribute("aria-disabled"));
Using xpath
:使用xpath
:
System.out.println(new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='StandardSave']"))).getAttribute("aria-disabled"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.