Web Test Automation Flashcards
What is Selenium?
Selenium is an API-based web testing tool supporting multiple browsers and languages, capable of handling frames, popups, and AJAX elements.
What are the two main Selenium objects?
Driver and WebElement.
What does the Selenium Driver object do?
It allows interaction with the browser, including navigation, accessing page source, and finding elements.
What does the Selenium WebElement object do?
It encapsulates web page elements, allowing querying and interaction such as clicking, submitting, and setting text.
How can web elements be located in Selenium?
By id, CSS selector, class name, name, link text, tag name, and XPath.
What is the difference between findElement() and findElements()?
findElement() returns the first matching element or throws an exception if none is found, while findElements() returns a list of all matching elements or an empty list if none are found.
How can dynamic timing issues be handled in Selenium?
Using WebDriverWait and ExpectedConditions instead of Thread.sleep().
What is a Page Object Design Pattern?
It abstracts the web front end by creating an object model around it, making tests more maintainable and readable.
What are the benefits of using the Page Object Design Pattern?
Improved test readability and maintainability by abstracting web elements and their interactions.
How can you test adding an item to a shopping cart on Amazon using Selenium?
Search for an item, click the second result, add it to the basket, view the basket, and verify the item exists in the basket.
How should developers be involved in automated testing?
Developers should create conventions, assign unique IDs for important components, and promote testability.
What does the Page Object Design Pattern consist of?
Creating a class for each page component, passing WebDriver through the constructor, and implementing methods for page interactions.