0
0
Selenium Javatesting~10 mins

First Selenium Java test - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to open a Chrome browser using Selenium WebDriver.

Selenium Java
WebDriver driver = new [1]();
Drag options to blanks, or click blank then click option'
AFirefoxDriver
BChromeDriver
CSafariDriver
DEdgeDriver
Attempts:
3 left
💡 Hint
Common Mistakes
Using FirefoxDriver when ChromeDriver is needed.
Forgetting to instantiate the driver.
2fill in blank
medium

Complete the code to navigate to the URL 'https://example.com'.

Selenium Java
driver.[1]("https://example.com");
Drag options to blanks, or click blank then click option'
Aopen
Bnavigate
Cget
Dvisit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'navigate' directly instead of 'get'.
Using non-existent methods like 'open' or 'visit'.
3fill in blank
hard

Fix the error in the code to find an element by its ID 'submitBtn'.

Selenium Java
WebElement button = driver.findElement(By.[1]("submitBtn"));
Drag options to blanks, or click blank then click option'
Aid
Bname
CclassName
DtagName
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'name' or 'className' instead of 'id'.
Using 'tagName' which looks for HTML tags.
4fill in blank
hard

Fill both blanks to click a button with ID 'loginBtn' and then close the browser.

Selenium Java
driver.findElement(By.[1]("loginBtn")).[2]();
Drag options to blanks, or click blank then click option'
Aid
Bclick
Csubmit
Dclose
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'submit' instead of 'click' to press the button.
Using 'close' on the element instead of the driver.
5fill in blank
hard

Fill the blanks to assert the page title is 'Welcome Page' using JUnit.

Selenium Java
String title = driver.getTitle();
[1]("[2]", title);
Drag options to blanks, or click blank then click option'
AassertTrue
BassertEquals
CWelcome Page
DassertFalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using assertTrue or assertFalse instead of assertEquals.
Mixing up expected and actual values.