Member-only story
Selenium Interview Questions
Selenium Basics:
Q: What is Selenium WebDriver, and how does it differ from Selenium IDE?
A: Selenium WebDriver is a tool for automating web applications. It provides a programming interface for interacting with web elements and is more powerful than Selenium IDE, which is a record-and-playback tool.
Q: Explain the differences between implicit wait, and explicit wait.
A: Implicit wait sets a global timeout for the driver to wait for an element. Explicit wait waits for a specific condition to be met before proceeding.
Q: When would you use the driver.close() and driver.quit() methods in Selenium?
A: driver.close() closes the current browser window, while driver.quit() closes all browser windows and ends the WebDriver session. Use quit() to ensure all resources are released after testing.
Q: How can you handle multiple windows in Selenium WebDriver?
A: Use getWindowHandles() to get all window handles, switch between them using switchTo().window(handle), and close or interact with specific windows accordingly.
Locators and FindElement Strategies:
Q: Explain the differences between ID, Name, Class Name, and Tag Name locators in Selenium.