0
0
Selenium Javatesting~10 mins

Java environment setup (JDK, IDE) in Selenium Java - Interactive Code Practice

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

Complete the code to print the installed Java version.

Selenium Java
System.out.println(System.getProperty([1]));
Drag options to blanks, or click blank then click option'
A"java.version"
B"jdk.version"
C"java.home"
D"os.name"
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect property keys like "jdk.version" or "java.home"
Forgetting to put the property key inside quotes
2fill in blank
medium

Complete the code to set the path for the ChromeDriver executable in Selenium.

Selenium Java
System.setProperty([1], "/path/to/chromedriver");
Drag options to blanks, or click blank then click option'
A"chrome.driver.path"
B"webdriver.chrome.driver"
C"webdriver.gecko.driver"
D"selenium.driver.path"
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong property keys like "selenium.driver.path" or "webdriver.gecko.driver"
Missing quotes around the property key
3fill in blank
hard

Fix the error in the code to launch ChromeDriver in Selenium.

Selenium Java
WebDriver driver = new [1]();
Drag options to blanks, or click blank then click option'
AChromeDriver
BFirefoxDriver
CInternetExplorerDriver
DSafariDriver
Attempts:
3 left
💡 Hint
Common Mistakes
Using FirefoxDriver or other drivers when ChromeDriver is needed
Not importing the correct driver class
4fill in blank
hard

Fill both blanks to import the Selenium WebDriver and ChromeDriver classes.

Selenium Java
import org.openqa.selenium.[1];
import org.openqa.selenium.[2].ChromeDriver;
Drag options to blanks, or click blank then click option'
AWebDriver
Bchrome
Cwebdriver
Dfirefox
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect package names like "webdriver" or "firefox"
Confusing class names with package names
5fill in blank
hard

Fill all three blanks to create a basic Selenium test that opens Google and closes the browser.

Selenium Java
WebDriver driver = new [1]();
driver.[2]("https://www.google.com");
driver.[3]();
Drag options to blanks, or click blank then click option'
AChromeDriver
Bget
Cquit
Dclose
Attempts:
3 left
💡 Hint
Common Mistakes
Using close() instead of quit() which only closes one window
Forgetting to create the driver instance before calling methods