1. Need to install TestNG from Eclipse Market Place
Steps: Open Eclipse > go to Help option > click on Eclipse Marketplace > a new window with search box will display.
Type TestNG for Eclipse. Then Install this one.public class OpenpageUrl {
@Test
public void openeSchool() {
Now you can have to import : import org.testng.annotations.Test; (other wise @Test will show red text).
exp:
package BrowseURL;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;
public class OpeneSchoolJourny {
or click on @Test then you can get option to click on import org.testng.annotations.Test;
and don't forget to save.
now you can run your class with TestNG.
Example:
package BrowseURL;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class OpeneSchoolJourny {
@Test
public void OpenSchool () {
WebDriverManager.chromedriver().setup();
WebDriver driver=new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.get("Your URL");
System.out.println("Title : "+driver.getTitle());
System.out.println("Current URL "+driver.getCurrentUrl());
//System.out.print("PageSource : "+driver.getPageSource());
}
}