Junior — Middle
Can you list the key classes used in Selenium for browser automation?
sobes.tech AI
Answer from AI
In Selenium for browser automation, the key classes are:
- WebDriver — the main interface for controlling the browser.
- ChromeDriver, FirefoxDriver, EdgeDriver, and others — implementations of WebDriver for specific browsers.
- By — a class for element locators (e.g., By.id, By.xpath).
- WebElement — represents an element on a web page that can be interacted with.
- Actions — for complex user interactions, such as drag-and-drop.
- ExpectedConditions — a set of conditions for explicit waits.
Example of creating a driver and finding an element:
WebDriver driver = new ChromeDriver();
driver.get("https://example.com");
WebElement button = driver.findElement(By.id("submit"));
button.click();