Selenium WebDriver - First Automation Script which covers all basic commands

This post will show you how to write your first Selenium Webdriver script. It will cover some of the very basic Webdriver commands. It covers following web actions and commands for same:
  1. Launch browser.
  2. Open demo url.
  3. Enter value in some text fields.
  4. Select Radio box.
  5. Select Checkbox.
  6. Click on Submit button
public class FirstWebdriverScript {

public static void main(String[] args) {

// Initialize Webdriver Object
System.setProperty("", "D:\\mydir\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
String browserUrl = "";
String firstName = "Mark";

// Opening Browser URL and Maximize Window

// Page Elements or locators
WebElement FIRST_NAME_FIELD = driver.findElement("firstname"));
WebElement RADIO_BUTTON = driver.findElement("sex-1"));
WebElement PROFESSION = driver.findElement("profession"));
WebElement SUBMIT_BUTTON = driver.findElement("submit"));

// Clear pre-values in textfield

// Enter Text

// Select Radio Button;

// Select Profession;

// Click on Submit Button;

// Close browser



For complete list of Selenium tutorials click here: Selenium Webdriver Tutorials Series

Join Telegram channel at
Feel free to ask queries or share your thoughts in comments or email me.


Popular Posts

Top 10 Demo Websites to Practice Selenium Webdriver Online

Selenium WebDriver - Web Form Commands: Enter and Get Text, Click & Select Dropdowns

Selenium WebDriver - Actions Class Keyboard Events

Top 20 Advanced Selenium Webdriver Coding Interview Questions of 2019

Selenium WebDriver - Browser and Navigation Commands