Home > Selenium (Page 5)

Write xpath using text and text functions in selenium?

Write Xpath using element text and string functions. Information for this section  Symbols used while Xpath creation ./ (period symbol and forward slash)      → Current element /* (forward slash and asterisk symbol)   → All child element of current element .. (double period symbol)                          → Immediate parent

This Article is TAGGED in , , , . Read more

Write xpath using attribute and tag name in Selenium

Xpath Basic Information Xpath is a language and used to find targeted web element within html document. Types of Xpath Absolute Xpath: Path from root element to targeted element without missing any elements in between. Absolute xpath could be form by using '/' (single forward slash) and '[index]' (square bracket with index). Example: To locate <input>

This Article is TAGGED in , , , . Read more

Compare images using Java

This code will compare pixel from base image with other image. If both pixel at location (x,y) are same then add same pixel in result image without change. Otherwise it modifies that pixel and add to our result image. In case of baseline image height or width is larger than other image

This Article is TAGGED in , , . Read more

Code to locate element by Name using Selenium Webdriver

Locator Type: Name  Name attribute is unique throughout html document except checkbox and radio button.  Name attribute is not unique if multiple radio button and checkboxes used with same name.  Name attribute used with iframe which can be used to switch driver from current web page to iframe by using name.  Java code to

This Article is TAGGED in , , . Read more

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-673f593ac0cfb481997508/] Code to scroll vertically UP by 500 pixel: [crayon-673f593ac0d00285172797/] Code to scroll horizontally RIGHT by 500 pixel: [crayon-673f593ac0d03624611826/] 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-673f593ac1191704792302/] Steps to find ID attribute of web element. Open

This Article is TAGGED in , , , . Read more