Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect property keys like "jdk.version" or "java.home"
Forgetting to put the property key inside quotes
✗ Incorrect
The system property "java.version" returns the installed Java version.
2fill in blank
mediumComplete 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong property keys like "selenium.driver.path" or "webdriver.gecko.driver"
Missing quotes around the property key
✗ Incorrect
The correct system property key to set ChromeDriver path is "webdriver.chrome.driver".
3fill in blank
hardFix 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using FirefoxDriver or other drivers when ChromeDriver is needed
Not importing the correct driver class
✗ Incorrect
To launch Chrome browser, you must create an instance of ChromeDriver.
4fill in blank
hardFill 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'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect package names like "webdriver" or "firefox"
Confusing class names with package names
✗ Incorrect
WebDriver is imported from org.openqa.selenium, and ChromeDriver is in org.openqa.selenium.chrome package.
5fill in blank
hardFill 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'
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
✗ Incorrect
Create ChromeDriver instance, use get() to open URL, and quit() to close browser and end session.