1

I am using protractor v4.0.9 and node v6.8.1 (although I have also tested this issue on 4.6). I have a test that runs through a series of button clicks to get to a form. The code looks something like this:

browser.get('http://someurl');

// App select button
element(by.id('btn-select-app')).click();

// portal select 
element(by.id('row-test-portal')).click();

// provisioning form button
element(by.id('btn-provisioning-form')).click();

This is then followed by a function that iterates through the form and fills it out. If I run the test from start to finish (including the function that fills out the form) it will fail when it tries to start filling out the form because it is on the wrong page - that is, even though the terminal is telling me it executed the click on the provisioning button, the form did not load.

If I shorten the test and run it only with the commands you see in the block above, it passes.

When I run it in debug mode I can execute the "element(by.id('btn-provisioning-form')).click();", but it doesn't appear to actually do anything - it will tell me it executed the the click, but the form does not appear on the page - I am still on the previous page. Note that the above test contains another button click prior to the click on the provisioning form button and that appears to work normally.

I have gone so far as to use different locators for the button including xpath and css but the nothing will get me to the provisioning form.

Button code

<div class="col-md-1">
     <button id="btn-provisioning-form" ng-show="foo()" 
      class="btn btn-success glyphicon etc" ng-click="blah()" 
      aria-label="Provision" popover="Provision" popover-trigger="mouseenter">+</button>
</div>

Some other notes - I have managed to replicate the test using Selenium IDE and when I run that test from the Selenium IDE UI, it is able to click the button and get to the form. It looks like this issue is just being seen when I use protractor.

TL;DR : Protractor is telling me it clicked the button, but the button click isn't causing any change to the page. When I manually click the button outside of protractor, it works just fine. Why is this happening?

  • Take a look at [Protractor wait for isElementPresent and click on waited element fails](http://stackoverflow.com/questions/28025342/protractor-wait-for-iselementpresent-and-click-on-waited-element-fails) – MikeJRamsey56 Nov 01 '16 at 21:44
  • Hi Mike - I have already tested .isPresent (was true) and after looking at this I also tried adding .isDisplayed - I did this in the test and in the debugger and in both cases it was true and the went to the click. The click still didnt bring me to the next page and didn't fail. I also added browser.waitForAngular(); before the click and got the same result. – MagnusTheRed Nov 02 '16 at 00:06
  • Is this a timing issue? What if you, for debugging purposes, would add `browser.sleep(5000)` after the click? Thanks. – alecxe Nov 02 '16 at 14:14
  • Display the page in question manually using google chrome. Right click on the button you want to press and select Inspect. In Dev tools, right-click the hi-lighted element and choose Copy -> Copy selector. Paste into a comment and show us. – MikeJRamsey56 Nov 02 '16 at 15:44

1 Answers1

0

Instead of normal protractor click , try clicking through JavaScript code.

Vishal Aggarwal
  • 1,929
  • 1
  • 13
  • 23