node.js - Terminating each() block in Protractor -


I was automating an application (using protractor) and I came in a situation where I I want to select the keyboard to move forward using the arrow buttons below. Here's how I am coming for this kind of action.

  1. After typing part in the text field, I am getting a reference to every option that appears in the next type.
  2. Now, I am using Protractor's .each () method to repeat through each option.
  3. I repeat the script to hit the down arrow button through each option. Write forward that say 10 options appear in the next type and the option I choose is the 5th place Is on. Now when I reach the 5th position I am opting for the option, but each () function still continues.

    I should end the loop when something like the statement is required for some loop when the required option is selected.

    BTW I have tried to do the above scenario with the loop, but then (unable to use the statement BREAK) inside the handler.

    Please tell me how to cope with this situation.

    You can throw an exception to the end of the loop, keep it in the loop and use the hold So that your results can be tilted. You can also use the Boolean variables to indicate that you've had a match and ignore everything after that point, though I use only one loop, though.

    EDIT: You can add a variable to catch an action before all the benchmarks.

      var action   

    then inside the test

      if (choose from data value == option) {action = Function () {benchmark.click ();   

    Action call after loop exit

      if (verb) verb ()    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -