-1

I tried:

ExpectedConditions.presenceOfElementLocated(By.cssSelector("[id='StandardSave'][aria-disabled='true']" 

but still won't work.

JeffC
  • 22,180
  • 5
  • 32
  • 55
Andrae Sy
  • 1
  • 1
  • What does "won't work" mean? Does it throw an error, exception, ...? We will need the relevant HTML (as text) in order to see if your locator is correct. Please edit your question and add the full error/exception message along with the relevant HTML. – JeffC Dec 19 '19 at 21:27

1 Answers1

0

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:

  • Using id:

    System.out.println(new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.id("StandardSave"))).getAttribute("aria-disabled"));
    
  • Using cssSelector:

    System.out.println(new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#StandardSave"))).getAttribute("aria-disabled"));
    
  • Using xpath:

    System.out.println(new WebDriverWait(driver, 20).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id='StandardSave']"))).getAttribute("aria-disabled"));
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352