TechPro
Office address BhauAutomation VTP Cygnus Pune bhauautomationlab@gmail.com

Welcome to BhauAutomation!

Want to learn automation testing? Let’s start with Selenium WebDriver using simple English and practical Java examples.

What Is Selenium WebDriver?

Selenium WebDriver is a free, open-source tool that helps automate web browsers.

For example, instead of manually entering login details and clicking buttons, Selenium can perform these actions using code.

Why Do We Use Selenium?

  • Automate repetitive testing tasks.

  • Save time and effort.

  • Test websites on supported browsers.

  • Work with Java, Python, and other languages.

  • Integrate with testing frameworks like TestNG.

Tools You Need

  • Java JDK

  • Eclipse or IntelliJ IDEA

  • Selenium WebDriver

  • Google Chrome

  • Maven (for managing dependencies)

Your First Selenium Program

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class FirstTest {
    public static void main(String[] args) {
        WebDriver driver = new ChromeDriver();

        driver.get("https://example.com");
        System.out.println(driver.getTitle());

        driver.quit();
    }
}

Output:

Example Domain

This program opens a website, prints its title, and closes the browser. Add Selenium to your project before running it.

What Are Selenium Locators?

Locators help Selenium find elements on a webpage.

Common locators include:

  • ID

  • Name

  • Class Name

  • CSS Selector

  • XPath

Example:

driver.findElement(By.id("username"))
      .sendKeys("testuser");

This code enters testuser into the username field.

What Should You Learn Next?

  1. Browser commands

  2. Locators and XPath

  3. Waits and alerts

  4. Dropdowns and frames

  5. TestNG and assertions

  6. Automation framework development

Frequently Asked Questions

Is Selenium free? Yes, Selenium is open-source.

Is Java compulsory? No. Selenium supports multiple programming languages.

Can beginners learn Selenium? Yes! Start with basic Java and practise simple automation programs.

Conclusion

Selenium WebDriver makes website testing easier by automating browser actions. Practise regularly, build small projects, and gradually develop your automation skills.

Keep Learning with BhauAutomation!

Explore more tutorials on Java, Selenium, API Testing, and Automation Testing Interview Questions.

Leave a Reply

Your email address will not be published. Required fields are marked *