Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor: Can I proceed with execution of the test if I close browser earlier in it?

I have a question: Is it posible to continue with execution of one test, if I have earlier closed browser in it?

For example, I want to check is the user in my application logged in, even when I restart browser. I want to check that with and without "Remember me" checkbox.

After I login my user in app, I try with this:

browser.close();

but test ends and can not be continued further. If i try with this:

browser.get("");
browser.get("about:blank");

only blank tab is open, and test ends.If I try with:

browser.quit();

than whole session is killed and test is ended,

If anyone knows solution, or have some ideas, please answer. Thanks

like image 241
Dejan Jankovic Avatar asked May 26 '14 12:05

Dejan Jankovic


People also ask

How do you close a browser on a Protractor?

Purpose: The close() function in ProtractorBrowser class is used to close the current instance of the browser. Note: Protractor automatically closes after the execution of all tests or specs. However, if needed user can close the current browser window forcibly using close() command.

How do you run a Protractor test in multiple browsers?

Testing Against Multiple Browsers If you would like to test against multiple browsers, use the multiCapabilities configuration option. Protractor will run tests in parallel against each set of capabilities. Please note that if multiCapabilities is defined, the runner will ignore the capabilities configuration.

How do I close a pop up window in Protractor?

The dismiss() alert class method is used to close the alert for handling alerts in Selenium. It operates by clicking on the “X” button in the prompt. This method is functional for all alert types: prompt, alert and confirmation dialogue box. The protractor web driver uses a void dismiss() command to cancel the alert.

How does Protractor wait for angular?

For Angular apps, Protractor will wait until the Angular Zone stabilizes. This means long running async operations will block your test from continuing. To work around this, run these tasks outside the Angular zone.


1 Answers

You'll be able to do this with the next release of Protractor, which includes the new browser.forkNewDriverInstance function. This lets you create a new instance of your browser via webdriver. See the commit (https://github.com/angular/protractor/commit/0bbfd2b6d38392938781d846ad37b5a0fd964004) for more information.

like image 95
Jmr Avatar answered Jan 03 '23 02:01

Jmr