Search code examples
angularprotractorend-to-end

Protractor issue: click() function isn't working


I have one senario the button click function is being used by lot of e2e cucumber test cases. I am able to get the text of the button. But if clicking its not redirecting or loading any contents.

var next = element(by.cssClass('buttonclass'));
next.click();

The above code is not working but if I am using browser.executeScript("arguments[0].click();",next ) then the click is working. I cant change the code since its being used by multiple test cases.... What will be the reason?


Solution

  • Try this instead

    var next = element(by.css('buttonclass'));