Home > Java (Page 2)

Selenium WebDriver Locator: Tag Name

Locator Type: Tag Name  HTML document is structure of different html elements which normally contains start tag with attribute closing tag and some text within opening and closing tag.  Opening tag consist within Tag Name within two angular brackets (‘<’ and ‘>’) while closing tag contains forward slash before Tag Name within angular brackets. Java code to find

This Article is TAGGED in , , , . Read more

Java Apache POI: Read or Modify data in excel file

Read and write excel file in java Pre-requisite:Download latest apache poi library.  Add below mentions jar files in build path from downloaded compressed file. commons-codec-1.11.jar commons-logging-1.2.jar jaxb-api-2.3.0.jar junit-4.12.jar poi-excelant-4.0.0.jar poi-scratchpad-4.0.0.jar commons-collections4-4.2.jar commons-math3-3.6.1.jar jaxb-core-2.3.0.1.jar log4j-1.2.17.jar poi-ooxml-4.0.0.jar xmlbeans-3.0.1.jar commons-compress-1.18.jar curvesapi-1.05.jar jaxb-impl-2.3.0.1.jar poi-4.0.0.jar poi-ooxml-schemas-4.0.0.jar activation-1.1.1.jar   Class which contains read and write function. [crayon-67677380a73e1199801985/]   Read and write functions from ExcelReadWrite class used. [crayon-67677380a73e9770679257/] Code Execution Result: Changes in excel file before and after code execution.       Selenium Tutorial >>

This Article is TAGGED in , , . Read more

Use Actions class to perform keyboard event in selenium

Code to perform key press events , mouse left right operations using action class. Functions for keyboard Uses keyDown(java.lang.CharSequence key) To simulate key down event on current location. keyDown(WebElement target, java.lang.CharSequence key) To simulate key down event on target element. keyUp(java.lang.CharSequence key) To simulate key up event on current location. keyUp(WebElement target, java.lang.CharSequence key) To simulate key up event on

This Article is TAGGED in . Read more

Use Action class to perform drag and drop In selenium

Drag and drop activity performed by using Actions class. dragAndDrop(WebElement source, WebElement target) → It used to drag source element to target web element. dragAndDropBy(WebElement source, offsetX , offsetY) →  It used to drag source web element to targeted location using offset. Code snippet: [crayon-67677380a76ea792939149/]  

This Article is TAGGED in , , . Read more

Use of actions class to perform mouse operation in selenium

In Selenium Action class is used to perform drag and drop operation move any element Press composite key hover on element Click action related function with their uses Click and Move Actions Their uses click() Perform left click action on current mouse position. click(WebElement target) Perform left click action on center of given web element. contextClick() Perform right/context click action on current mouse

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

DOM traversing & manipulating in JavaScript

Hello everyone, in this post we will discuss about following points on Document Object Model (DOM). What is DOM? DOM traversing DOM manipulating What is DOM? The Document Object Model (DOM) is a programming API for HTML and XML. API specification defined by the World Wide Web Consortium (W3C). DOM represents how to write HTML and

This Article is TAGGED in . Read more