- WebDriver is an interface in Selenium.
- If the driver executable is not added, Selenium won't be able to communicate with the browser, and a WebDriverException will be thrown.
- close(): Closes the current browser window.
- quit(): Closes all the browser windows and ends the WebDriver session.
- get(): Loads a new web page in the current browser window.
- navigate().to(): This does the same as get() but allows for additional navigation options like back, forward, and refresh.
- findElement: Returns a single WebElement or throws NoSuchElementException if not found.
- findElements: Returns a list of WebElements. If no elements are found, it returns an empty list.
- You can use the CSS selector a to find all links.
- Some common methods are: get() , getCurrentUrl() , getTitle(), findElement() , findElements() , getPageSource() , close() , quit(), navigate() , manage() .
- It returns the source code of the current page.
- Use findElements when you expect multiple elements. It returns a list of WebElements.
- This exception is thrown when WebDriver is unable to interact with the browser. Possible reasons include incorrect WebDriver setup, browser crashes, or network issues.
- Absolute XPath: Starts from the root and follows a complete path (e.g., /html/body/div ).
- Relative XPath: Starts from the middle of the HTML DOM structure (e.g., //div[@id='example'] ).
👋 Hi, I'm Suriya — QA Engineer with 4+ years of experience in manual, API & automation testing.
📬 Contact Me | LinkedIn | GitHub
📌 Follow for: Real-Time Test Cases, Bug Reports, Selenium Frameworks.