Issue
I'm using protractor to automate some fairly time sensitive tasks on a heavy angular site which takes around 15 seconds to load.
I would like to see if there is a way to keep the instance of chrome open (and the page loaded) between various tests in order to avoid the new load each time.
Solution
Protractor is a nice tool, so does proper cleaning after itself. I.e. It quits the browser if it started it.
So in order to keep your browsers alive between sessions, and save the 5-15 seconds, you can ask Protractor to attach to a browser session, instead of creating a new browser session.
This can be done using the config object, or via the command line.
<!-- language: typescript -->
/** in your protractor.conf.js or similar config object*/
directConnect: undefined, // can be omitted, but just to show that directConnnect must not be set
seleniumAddress: 'http://localhost:4444/wd/hub',
seleniumSessionId: '<your session id - 32 char hex code>',
However, starting a browser instance or finding a browser instance is not easy. It can be done using the Selenium Standalone Console available at http://localhost:4444/wd/hub, assuming that you have selenium running.
See the Webdriver-Reuse-Session NPM package for more details.
Answered By - AndreasM_DK
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.