Home > Automation Testing (Page 6)

Code to Handle alert, window and iframe in Selenium

SwitchTo() Functions are used to handle alert, browser window and iframe. driver.switchTo() functions are used to handle alert window, new tab or new window in browser and iframe within html document.  Refer below table for switchTo functions and their uses: switchTo functions  Uses driver.switchTo().frame(index); Switch focus to iframe element using index of iframe in html document. driver.switchTo().frame("iframe_name"); Switch

This Article is TAGGED in , . Read more

API Automation Using Katalon Studio

Follow below steps to cofigure API Automation project. 1.Open Katalon studio by running exe file. 2.By Default it will create folders as shown below. 3.Right click on Object Repository > New > Web Service Request 4.Enter Name, Request Type and URL and click on OK 5.Test the API by clicking on Test Request 6.After successful response

This Article is TAGGED in , . Read more

Code to scroll in web page using selenium

Scroll can be done in two ways one is horizontal and another is vertical. In selenium scroll operation is done using JavaScriptExecutor. Code to scroll vertically Down by 500 pixel: [crayon-6765499952870497783740/] Code to scroll vertically UP by 500 pixel: [crayon-6765499952874148583711/] Code to scroll horizontally RIGHT by 500 pixel: [crayon-6765499952877061828672/] Code to scroll horizontally LEFT by 500

This Article is TAGGED in . Read more

Difference between find element and find elements in Selenium

Difference between find element and find elements. findElement() findElements() findElement() method used to access single web element findElements() method used to access multiple web elements. findElement() method returns first matching web element findElements() method returns list of all matching web elements If there is no matching web element then findElement() method throws exception If there is

This Article is TAGGED in , . Read more

Selenium WebDriver Locator by ID

Here is example to find element by Locator Type as ID  ID is attribute used with HTML element to uniquely identify it in HTML document.  Faster and easiest way to locate an element in HTML document using selenium.  How to find web element by using id in Java language [crayon-6765499952ada356370987/] Steps to find ID attribute of web element. Open

This Article is TAGGED in , , , . Read more

Code to perform Image comparison in protractor

To perform image comparison in GUI Testing we need to install protractor-image-comparison module it can be installed using below command. Open command prompt and run below command. [crayon-6765499952bfe277893277/] Add below code in onPrepare function of configuration file [crayon-6765499952c02202616317/] Code to do image comparison [crayon-6765499952c04957632741/] ImageName is image file name exist in baseline folder. If image is not

This Article is TAGGED in , . Read more

Selenium – Introduction and Basics

Automation testing – In STLC, Regression testing plays most important part which verifies old functionalities of a web application is working fine while new changes also get along with them well. But the regression testing can be a lengthy and time consuming process. So the testing processes which are repetitive

This Article is TAGGED in , , . Read more

Simple protractor script

Code for sample protractor script: In protractor there are two basic files to execute any automation script. Those are configuration file and specification file. Configuration file contains all configuration related code. And specification file contains test scripts. Configuration file is one for the project and we can have any number

This Article is TAGGED in . Read more

How to install protractor and configure?

To configure protractor below are the steps: 1. Download eclipse from https://www.eclipse.org/downloads/ and install it. 2. Download node.js from https://nodejs.org/en/download/ and install it. 3. Open the command prompt and run below command. It will install protractor globally. “npm install -g protractor”. 4. Run below command in protractor to update webdriver. “webdriver-manager update“. 5. Start the selenium server by running

This Article is TAGGED in . Read more

Handling Popups using protractor

Identify or handle javascript popup/alert using protractor in automation. Javascript popup cannot be inspected. We don't get html for javascript popup. So we cannot find element and it is not possible to perform operation based on web element. There are different types of java script popups. Those are Simple alert, Confirmation

This Article is TAGGED in , , . Read more