title: Continue loop after getting alert test from browser in protractor jasmine test
body: <p>I am implementing Protrator framework with jasmine runner in my angular app. I click on each element with expected result. Now I have a list of companies in my app. each company has two or three machines is side bar. I implemented two for loops that with loop throug the company and machines as well. Now in one machine list there is an error and as a result is shows alert from localhost. For this reason the loop breaks and fails. I want to implement a condition there so that it can detect the condition and continue from the loop. But I could not get it how can I implement that.</p>
  
  <p>My test code</p>
  
  <pre><code>    for (let company = 0; company &lt; await companyOption.count(); company++) {
                  await companyOption.get(company);
  
                  for (let machine = 0; machine &lt; await machineList.count(); machine++) {
                          await click.onto(machineList.get(machine));
  
                    if (window.alert()) {
                     //here i want to implement if browser.switchto.alert() is appear then test should be continue to next loop
                          } else {
                              await expect(machineList.get(machine).isSelected());
  
                     }
  
               .................... other code
        }
  </code></pre>
  
  <p>Alert code in typescript</p>
  
  <pre><code>    ngOnInit() {
  
      this.route.paramMap.switchMap((params: ParamMap, index) =&gt; this.machineService.load(parseInt(params.get("machineId")))).subscribe(machine =&gt; {
          this.machine = machine;
          if (this.machine.type === null)
              window.alert("No machine type assigned for " + this.machine.name + "\nAssign a type to view the details.");
  
  
      });
  }
  </code></pre>