0

I have a button with the text "Sim" on it, and I'm tryng to click on it, but proctactor can't find the element, why? It is on the screen.

HTML

 <button class="btn btn-primary" type="button">
              <i class="zmdi zmdi-check"></i>
                   Sim
            </button>

Test Code

element(by.partialButtonText('Sim')).click();

Error

Failed: element not visible

paulotarcio
  • 461
  • 1
  • 5
  • 20

1 Answers1

0

Check for visibility of button using protractor.ExpectedCondtions. You can use below code.

Code Snippet:

  var EC=protractor.ExpectedConditions;
  var buttonSim=element(by.xpath(".//*[contains(text(),'Sim')]"))

  browser.wait(EC.visibilityOf(buttonSim).call(),8000,'Button not visible');
  buttonSim.click();
Optimworks
  • 2,537
  • 17
  • 20
  • For some other (less common) possibilities see http://stackoverflow.com/questions/37809915/element-not-visible-error-not-able-to-click-an-element – Jeremy Kahan Sep 07 '16 at 00:40