enter code here

for (var i=1; i<8 ; i++)

  var eleClick = element(by.xpath("//*[text()='Choices for Independence-Guidelines - 3705']"));

      console.log("Able to click");
      var nextPage = element(by.xpath("//*[text()='Next']"));


      console.log("Unable to click");


But when element is found it clicks the element 5 times. I have used break statement but it throws Illegal statement. Can someone please help.

  • 1
    Please SHOW the code where you use the break. It is hard to diagnose why it isn't working if we can't see the code you are using ! This site will help you solve your problem but we don't just write the 'right' code for you. – Michael Durrant May 12 '18 at 12:05
  • There are so many issues on so many levels in this piece of code. I don't know where to start from and what to suggest. – Vishal Aggarwal May 12 '18 at 13:33
  • For starters, why do you need a loop here? – Vishal Aggarwal May 12 '18 at 13:56
  • What are you trying to test here? – demouser123 May 12 '18 at 16:19

Browse other questions tagged or ask your own question.