Selenium WebDriver First Automation Script for Beginners

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



Form Commands (Click, Enter Text etc.)  << Previous     ||     Next >>  Handle Links

Follow Us

Quora Space | Facebook Page | Telegram Channel
Feel free to ask queries or share your thoughts in comments or email us.


Popular posts from this blog

10 Best Demo Websites for Automation Testing Practice

Automate 'User Registration' of E-commerce Website using Selenium

Automate Browser Actions on using Selenium

Automate E-Commerce Website using Selenium Webdriver