Thursday, March 31, 2016

Protractor : How to start selenium server using gulp

In our previous post we see how we can run multiple javascript file. There we have started our selenium server by typing the following command at the terminal and pressing enter button. Every time we have to run it manually when executing our protractor script.

[image71.png]

Gulp can handle the problem and it can run automatically when our protractor scripts start executing.

We have to add the following code in our gulpfile.js file.

Step 1 : At first add two variables like the following,

image

First one is for updating webdriver and second one is for starting Selenium server.

Step 2 : Now add this two task like the following,

image

Step 3 : Now modify default gulp.task() method.

image

Note that we have added two variables ‘webdriver_update’ and ‘webdriver_standalone’ as gulp.task() argument so that it runs first and then run the default task that means protractor script.

Step 4 : Now gulpfile.js file looks like the following,

image

Step 5 : Now run the protractor script using only gulp command and do not need to run selenium standalone server using manual command.

image

It first update selenium webdriver and then start the selenium standalone server. After that it starts executing protractor script.

image

That’s all from here. We will discuss more on gulp and protractor in future.

Happy UI Testing with Protractor!!!

Cypress: How to handle browser-based authentication pop up dialog in Cypress

Five years ago I have written a blog on how to handle browser-based authentication for selenium webdriver.   Now it is for cypress. Cypress...