A “Hello, World!” program generally is a computer program that outputs or displays the message “Hello, World!”. Such a program is very simple in most programming languages, and is often used to illustrate the basic syntax of a programming language. It is often the first program written by people learning to code.[1][2] It can also be used as a sanity test to make sure that a computer language is correctly installed, and that the operator understands how to use it.
https://en.wikipedia.org/wiki/%22Hello,_World!%22_program
With that in mind, a Selenium Hello World is a simple test, of checking the title on a page.
public class HelloWorld {
WebDriver driver;
@Before
public void setUp(){
// System Property for Gecko Driver
System.setProperty("webdriver.gecko.driver","path to koDriver\\geckodriver.exe" );
// Initialize Gecko Driver
driver = new FirefoxDriver();
}
@Test
public void helloWorldSelenium(){
// Open Google Page
driver.get("https://www.google.com/");
// Get Page Title
String pageTitle = driver.getTitle();
// Assert that the title is Google
assertEquals("Google",pageTitle);
}
@After
public void teardown(){
// close the driver
driver.quit();
}
}

Leave a Reply
You must be logged in to post a comment.