Cross Browser Testing using TestNG & Selenium | Cross Browser Testing
Code:
package com.general.interviewQuestions;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.edge.EdgeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.testng.Assert;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;
public class crossBrowserTest {
// purpose - expose errors in front end functionality
WebDriver driver;
FirefoxOptions firefoxoptions = new FirefoxOptions();
ChromeOptions chromeoptions = new ChromeOptions();
EdgeOptions edgeoptions = new EdgeOptions();
@Parameters("browser")
@BeforeTest
public void initializeBrowser(String browser) {
if(browser.equalsIgnoreCase("firefox")) {
WebDriverManager.firefoxdriver().setup();
driver = new FirefoxDriver();
System.out.println("Firefox is launched");
}
else if(browser.equalsIgnoreCase("chrome")) {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
System.out.println("Chrome is launched");
}
else if(browser.equalsIgnoreCase("edge")) {
WebDriverManager.edgedriver().setup();
driver = new EdgeDriver();
System.out.println("Edge is launched");
}
}
@Test
public void ValidateGoogleTitle() {
driver.get("https://www.google.com");
String getGoogleTitle = driver.getTitle();
String expectedTitle = "Google";
Assert.assertEquals(getGoogleTitle.contains("Google"), expectedTitle.contains("Google"));
System.out.println("Validation is successful");
}
@AfterTest
public void EndTest() {
driver.quit();
}
}
Chapters:
0:00 - Introduction to the video
0:15 - Explanation of cross browser testing manually
1:53 - Program for cross browser testing
9:40 - Execution of the program
Next Steps :
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
Must Watch Playlists
► 1. Javascript - • Javascript Factory
► 2. Puppetter - • Puppeteer
► 3. Cypress - • Cypress
► 4. Tech works - • Video
► 5. Vbscript Basics To Advanced - • VBScript Part 1 - Features Advantage...
► 6. Jmeter - • Jmeter Tutorials
► 7. Excel - • Videos On Excel
► 8. Appium - • Appium
► 9. Shares - • Shares
► 10. Javascript Interview Questions - • Javascript Interview Questions
► 11. C# Tutorials - • C# Factory
► 12. HTML & CSS - • HTML & CSS
► 13. Browser Console - • Browser Console
► 14. JSON - • Videos on Json
► 15. Specflow - • Specflow Tutorials
► 16. MongoDB - • MongoDB Tutorials
► 17. Postman - • Postman
► 18. Python - • Python
► 19. Typescript - • Typescript & Node Imp Questions
► 20. Node - • Node
► 21. Java Selenium Interview Questions: • Java and Selenium Imp
► 22. Real Time Interview Q & A: • Real Time Interview Questions
---------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------
#crossbrowsertesting
#selenium
#seleniumwebdriver
On this page of the site you can watch the video online Cross Browser Testing using TestNG & Selenium | Cross Browser Testing with a duration of hours minute second in good quality, which was uploaded by the user Azhar Techno Coder 05 April 2023, share the link with friends and acquaintances, this video has already been watched 1,348 times on youtube and it was liked by 47 viewers. Enjoy your viewing!