Saturday, October 31Be an Automation Engineer

Tag: Javascript

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.
    Find elements using javascript in protractor

    Find elements using javascript in protractor

    JavaScript, JS, Protractor

    There are many element location strategies available in protractor. Click here to know about element locators in protractor.

    by.js is one more element locating strategy available in protractor. We need to pass javascript code as a string or as a function to by.js to get single/multiple element(s).

    Pass javascript code as a string:

    Protractor vs WebdriverIO vs NightWatch

    JavaScript, JS, NightwatchJS, Node.js, Protractor, WebdriverIO

    JavaScript is now a popular choice of language for developing web applications. To test the applications developed in JavaScript, there seem too many end to end testing frameworks and tools which help in Unit testing, UI testing. However, to use one of them, one has to go through and analyse each tool and framework to know which suits their application » Continue Reading.