Cross Browser Testing using TestNG & Selenium | Cross Browser Testing

Veröffentlicht am: 05 April 2023
auf dem Kanal: Azhar Techno Coder
1,348
47

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


Auf dieser Seite können Sie das Online-Video Cross Browser Testing using TestNG & Selenium | Cross Browser Testing mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Azhar Techno Coder 05 April 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,348 Mal angesehen und es wurde von 47 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!