Skip to main content

Posts

Showing posts from August, 2020

POM in Selenium using Java and testNG

===================================================================  Below is the sample code for Page object model with page factory pattren. =================================================================== There are 3 classes as mentioned below: 1) Base Class: which contains all constants like page url, username, passord, filename etc. 2) Page class: which acts like object/webelement repositories like xpath/id/name or webelemnt objects instantiations and functions which have logic to do the operations on webelemnts. 3) test case class: this will actually perform the operations on webelements. Like enter data to textboxes, cliscking on a button, select dropdown values. =================================================================== Base class: below base class have a url, username and password are assigned. =================================================================== package POM; public class Constant {   //URL that need to be test final static String ...

Web Scrapping using Jsoup , Selenium and Java

 Web Scrapping using Jsoup , Selenium and Java In this article we will see how to do web scrapping using Jsoup and Selenium using Java. Jsoup Jar you can download from below links: https://jsoup.org/download http://www.java2s.com/Code/Jar/j/Downloadjsoup160jar.htm Below is the full code to do web scrapping and write the data to text file. In the following example we are navigating to a web which has a drop down with 12 values. For each value we select and clieck on a search button it will navigate to a page for which we have to scrape a data which is spread on multiple page. So we will srcrap all those data present on a multiple page. Navigate back to home page(page from which we have selected the dropdown value and cliecked on a search button) then again select next dropdown value and repeat the same procedure. This will repeat till we reach to the end of a dropdown values i.e. for all 12 dropdown values. Kindly please do comment when you find this as working for you. import java....