Skip to main content

how to create a sample selenium program

creating a sample selenium program is very simple you need to create a new project and add a class to new project and save. Now add the selenium library to your IDE Build path.

For example I am creating a sample programs for navigating to a webpage .

For Navigating to Web Page we need a method called "get" which lies inside a class WebDriver , This class is provided by the Selenium library .

We wont talk about TestNG because we don't need it now.

The test step would be

1. You need to fireup the web browser
2. navigate to webpage.

so the code will be like this.

package seleniumsampleproject;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
 * @author pradeek 
public class SeleniumSampleProject {
    public static WebDriver driver;
    public static void main(String[] args) {
        driver = new FirefoxDriver();

Here we created a instance of WebDriver class as driver and copying the firefox object to driver instance then navigate using get method.


Popular posts from this blog

creating first go program

for creating go program open your editor and paste this code, and save it as filename.go for example helloworld.go

package main import "fmt" func main() { fmt.Println("Hello, 世界") }
I will explain these codes in details for now , we will look how to run these code.

to run type go run helloworld.go  in terminal , we get

you can try golang online as well , golang