Selenium WebDriver Methods in Java (Locators Part 1)
By Bhau Automation
🎯 What You Will Learn
- Selenium WebDriver methods with examples
- Basic Selenium Locators (ID, Name)
- Navigation methods in Selenium
- Real-time automation examples
📌 What is Selenium WebDriver?
Selenium WebDriver is a powerful tool used for automating web applications. It allows you to write test scripts in Java and interact with web elements.
🔧 Selenium WebDriver Methods
- get() → Open URL
- getTitle() → Get page title
- getCurrentUrl() → Get current URL
- navigate() → Navigation actions
- manage() → Browser settings
- close() → Close current browser
- quit() → Close all browser sessions
🔍 Selenium Locators (Basic)
- By.id()
- By.name()
💻 Example Code
WebDriver driver = new ChromeDriver();
driver.get("https://example.com");
driver.findElement(By.id("username")).sendKeys("admin");
driver.findElement(By.name("password")).sendKeys("1234");
String title = driver.getTitle();
System.out.println(title);
⚡ WebElement Methods
- sendKeys()
- click()
- clear()
- getText()
🎯 Interview Questions
Q: What is difference between close() and quit()?
A: close() closes current window, quit() closes all browser sessions.
Q: What does get() method do?
A: It opens the specified URL in browser.
🎥 Watch Full Tutorial
🎓 Key Takeaways
- Understand WebDriver methods clearly
- Use ID locator for best performance
- Practice real-time examples
🚀 Created by Bhau Automation