0
0
Selenium Javatesting~5 mins

First Selenium Java test - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is Selenium WebDriver used for in testing?
Selenium WebDriver is used to automate web browsers. It helps testers simulate user actions like clicking buttons, entering text, and navigating pages to check if a website works correctly.
Click to reveal answer
beginner
In a Selenium Java test, what does the method driver.get("https://example.com") do?
It opens the web page at the URL "https://example.com" in the browser controlled by Selenium WebDriver.
Click to reveal answer
beginner
Why do we use driver.quit() at the end of a Selenium test?
To close the browser and end the WebDriver session. This frees up system resources and ensures the test ends cleanly.
Click to reveal answer
beginner
What is the purpose of assertions in a Selenium test?
Assertions check if the actual result matches the expected result. They help confirm that the web page behaves as intended during the test.
Click to reveal answer
beginner
Which locator strategy is recommended for finding elements in Selenium tests?
Using unique and stable locators like id or name attributes is recommended. They make tests more reliable and easier to maintain.
Click to reveal answer
What does the following Selenium Java code do? <br>
driver.findElement(By.id("submitBtn")).click();
ACloses the browser
BFinds a button with id 'submitBtn' and clicks it
COpens a new browser window
DTypes text 'submitBtn' into a field
Which method opens a web page in Selenium WebDriver?
Adriver.get()
Bdriver.open()
Cdriver.navigate()
Ddriver.load()
Why is it important to use driver.quit() after a test?
ATo refresh the page
BTo start a new test
CTo close the browser and end the session
DTo maximize the browser window
Which locator is usually the most reliable in Selenium tests?
AUnique id attribute
BXPath with long paths
CCSS selectors with many classes
DText content of elements
What is the main purpose of assertions in Selenium tests?
ATo close the browser
BTo open the browser
CTo find elements on the page
DTo check if the test passed or failed
Describe the basic steps to write and run your first Selenium Java test.
Think about what you do when you test a website manually and how Selenium automates those steps.
You got /7 concepts.
    Explain why choosing good locators is important in Selenium tests.
    Imagine trying to find a friend in a crowd using a clear description versus a vague one.
    You got /4 concepts.