Saturday, October 31Be an Automation Engineer


async / await to avoid control flow

async/await, Protractor, TypeScript

Many of us might have heard of control flow while using selenium based automation tools like selenium-webdriver(Javascript), protractor etc..

A brief idea about control flow for those who does not know about control flow.

What is control flow? “WebDriverJS (and thus, Protractor) APIs are entirely asynchronous. All functions return promises. WebDriverJS maintains a queue of pending promises, called the control » Continue Reading.

Take screenshot for every failed spec in protractor+jasmine

Jasmine, Protractor, TypeScript
Why we need screenshots?

Generally we need screenshot of the browser where the protractor got failed. It would increase our chances to quickly figure out the issue before getting into the code debug. 

How to take a screen shot in protractor?

Below is the code to take a screenshot using protractor.

browser.takeScreenshot().then(function (png) { var dirPath = './reports/screenshots/'; if (!fs.existsSync('./reports')) » Continue Reading.
Protractor with jasmine data provider – Write once test many times

Protractor with jasmine data provider – Write once test many times

Jasmine, JavaScript, Protractor
What is data provider?

When it comes to automation, data provider is an approach to pass test data to the automation tests. Each and every automation tool has it’s own way of providing test data to the automation When we take TestNG framework, it has @DataProvider annotation which will help to pass test data to the automation test.

Why we » Continue Reading.
Execute protractor tests using blocking proxy

Execute protractor tests using blocking proxy

blocking-proxy, Protractor

Before going to seen an example, let us know about blocking proxy.


What is blocking-poxy?

Blocking proxy is a tool which provides some additional functionality for the selenium based automation tools before hitting selenium server. Blocking proxy sits in between our automation code and the selenium server. We can use blocking-poxy to set some barriers to » Continue Reading.

Execute Asynchronous Javascript in protractor

JavaScript, Javascript Executor, Protractor

Protractor has two functions to execute javascript code in tests.

  • executeScript
  • executeAsyncScript
  • We’ve explained about executeScript with examples here.

    Now, Lets know about executeAsyncScript.

    browser.executeAsyncScript(Asnynchronousjavascript, args…)

    Basically protractor provided this method to execute any asynchronous javascript code. We need to use this method to execute a javascript which has ajax calls or timeouts in it.

    executeAsyncScript takes one » Continue Reading.

    Javascript Executor in protractor

    JavaScript, Javascript Executor, JS, Promise, Protractor

    Most of the time we interact with web elements using selenium internal methods like click, sendKeys, select etc..

    Why we need javascript executor? Selenium is written in the way that it should not interact hidden elements on the webpage. Real user can not interact with the hidden elements in the web page so selenium guys are also not allowing » Continue Reading.