package firsttestngpackage; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; import org.testng.Assert; import org.testng.annotations.*; public class firsttestngfile { public String baseUrl = "http://demo.guru99.com/test/newtours/"; String driverPath = "C:\\geckodriver.exe"; public WebDriver driver ; @Test public void verifyHomepageTitle() { System.out.println("launching firefox browser"); System.setProperty("webdriver.gecko.driver", driverPath); driver = new FirefoxDriver(); driver.get(baseUrl); String expectedTitle = "Welcome: Mercury Tours"; String actualTitle = driver.getTitle(); Assert.assertEquals(actualTitle, expectedTitle); driver.close(); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter