Automation Testing Questions
Automation Testing Questions
Answer: Selenium is an open-source tool used for automating web applications across
different browsers. It supports multiple programming languages, including Java, Python, C#,
and Ruby, and allows testers to simulate user interactions with a web application.
1. Implicit Wait: Waits for a specific amount of time before throwing an exception if
the element is not found.
2. Explicit Wait: Waits for a specific condition to be met before proceeding.
3. Fluent Wait: A more flexible version of explicit wait that allows you to set polling
intervals.
1. By ID
2. By Name
3. By Class Name
4. By Tag Name
5. By Link Text
6. By Partial Link Text
7. By CSS Selector
8. By XPath
6. What is the difference between driver.get() and
driver.navigate().to()?
Answer:
o Implicit Wait: Automatically applies to all elements in the script, waits for a
specified time before throwing an exception if an element is not found.
o Explicit Wait: Used for specific elements, waits until a certain condition is met
before proceeding (e.g., visibility, presence).
java
Copy code
File scrFile = ((TakesScreenshot)
driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(scrFile, new
File("path/to/save/screenshot.png"));
Answer:
java
Copy code
Actions actions = new Actions(driver);
actions.dragAndDrop(sourceElement,
targetElement).perform();
java
Copy code
//Select select = new
Select(driver.findElement(By.id("dropdown")));
select.selectByVisibleText("Option 1");
select.selectByValue("option2");
select.selectByIndex(1);