Posts

For Get Dynamic data & USe it into Postman Body parameters

Need to Add script in Pre-request script tab   1. Registration call window  =  {}; pm . sendRequest ( "https://cdnjs.cloudflare.com/ajax/libs/Faker/3.1.0/faker.min.js" , ( error ,  response )  =>  { var   text   =   response . text (); ( new   Function ( text ))(); window. faker . locale   =   "en_IND" ; var   email   =  window. faker . internet . email () console . log ( email ) pm . collectionVariables . set ( "User_Email" ,  email );  var   Password   =  window. faker . internet . password () console . log ( Password ) pm . collectionVariables . set ( "User_Password" ,  Password );  })           2. Insert Person window  =  {}; pm . sendRequest ( "https://cdnjs.cloudflare.com/ajax/libs/Faker/3.1.0/faker.min.js" , ( error ,  response )  =>  {      var   text   =   response...

Login through Data Driven Testing in selenium

UserLogin .java package UserStory; import org.openqa.selenium.By; import org.testng.annotations.BeforeTest; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import com.aventstack.extentreports.ExtentReports; import BasePackage.Startup; import UserStory_webelements.UserLoginwbElements; import Utility.ExcelFileReader; import io.github.bonigarcia.wdm.WebDriverManager; public class UserLogin extends Startup implements UserLoginwbElements { public static ExtentReports report; public static ExcelFileReader data1 = new ExcelFileReader( "C:\\Users\\TechExtensor 21\\Downloads\\DisBox\\src\\main\\resources\\Excelsheet\\MemberLogin.xlsx"); @BeforeTest public void openDriver() throws InterruptedException { WebDriverManager.chromedriver().setup(); setBrowsers("Chrome"); driver.manage().window().maximize(); report = new ExtentReports(); Launchchannel(); Thread.sleep(7000); } @Test(dataProvider = "getdataXls...

How does Selenium Webdriver handle SSL certificate in Chrome?

  For the Chrome browser, one can handle the  SSL certificates  using  ChromeOptions  class provided by  Selenium WebDriver . It is a class that we can use to  set properties for the Chrome browser . Let us now see what additions we will make to the existing code, and then we will understand the same import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; public class SSLHandling { public static void main (String[] args) { //Create instance of ChromeOptions Class ChromeOptions handlingSSL = new ChromeOptions (); //Using the accept insecure cert method with true as parameter to accept the untrusted certificate handlingSSL.setAcceptInsecureCerts( true ); //Creating instance of Chrome driver by passing reference of ChromeOptions object WebDriver driver = new ChromeDriver (handlingSSL); //Launching the URL driver.get( "ht...

API Automation Testing Script to check Response

pm . test ( "Status code is 200" ,  function  () {      pm . response . to . have . status ( 200 ); }); pm . test ( "Check Status Code is 200" ,  function  () {      var   jsonData   =   pm . response . json ();       var   statusCode   =   jsonData . StatusCode      pm . expect ( statusCode ). is . equal ( "200" ) }); // To check response string or parameters   pm . expect ( pm . response . text ()). to . include ( "EmploymentStatus_ID" ); pm . test ( "To Check Existancy of Fields" ,  function  () {      pm . expect ( jsonData . Result . user . UserName ). exist      pm . expect ( jsonData . Result . Token ). exist      pm . expect ( jsonData . Result . RefreshToken ). exist }); // To get collection variable va...

How to open new window by right clicking on any link & click on any context menu options?

Right Click on webelement & click on second options from context menu.            @Test public static void newwindow() throws InterruptedException, AWTException {                      driver = new ChromeDriver(); driver.get("https://www.selenium.dev/documentation/webdriver/browser/windows/"); Thread.sleep(3000); Actions actions = new Actions(driver); WebElement elementLocator = driver.findElement(By.xpath("//*                                                                                                                     ...

How to check ascending and descending order with pagination?

 package Admin; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.testng.Assert; import org.testng.annotations.Test; import BaseInit.BaseInit; import MyMethods.MyLoginMethods; public class Sorting extends BaseInit { @Test public static void sortingtest() throws InterruptedException { // Login to Admin Panel MyLoginMethods.AdminLogin(datap.getProperty("email"), datap.getProperty("Pass")); driver.get(sitedata.getProperty("confiProURL")); Thread.sleep(2000); ArrayList<String> ActualList = new ArrayList<String>(); ArrayList<String> sortedList = new ArrayList<String>(); String[] pageItem = epresent("pageItem_className").getText().split(" "); String TotalPage = pageItem[3].trim(); System.out.println("Items per Page is- " + TotalPage); int PagePerItem = Integer.parse...