Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a RemoteWebDriver instance connecting to the Selenium Grid URL.
Selenium Java
WebDriver driver = new RemoteWebDriver(new URL([1]), new ChromeOptions()); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using an incorrect protocol like ftp.
Using wrong port number or missing /wd/hub path.
✗ Incorrect
The Selenium Grid default URL is usually "http://localhost:4444/wd/hub" for RemoteWebDriver connection.
2fill in blank
mediumComplete the code to set the browser to Firefox in DesiredCapabilities for RemoteWebDriver.
Selenium Java
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setBrowserName([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase letters like "Firefox" which is case-sensitive.
Setting wrong browser names like "firefoxbrowser".
✗ Incorrect
To use Firefox browser, set the browser name to "firefox" in DesiredCapabilities.
3fill in blank
hardFix the error in the code to correctly initialize RemoteWebDriver with capabilities.
Selenium Java
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), [1]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing DesiredCapabilities object directly causes deprecation warnings or errors.
Using ChromeOptions when Firefox is intended.
✗ Incorrect
RemoteWebDriver expects a Capabilities object like FirefoxOptions or ChromeOptions, not DesiredCapabilities directly.
4fill in blank
hardFill both blanks to create a RemoteWebDriver with ChromeOptions and set implicit wait timeout.
Selenium Java
ChromeOptions options = new ChromeOptions(); WebDriver driver = new RemoteWebDriver(new URL([1]), [2]); driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing FirefoxOptions with ChromeOptions.
Using wrong URL or missing /wd/hub path.
✗ Incorrect
Use the default Selenium Grid URL and ChromeOptions to create the RemoteWebDriver instance.
5fill in blank
hardFill all three blanks to create a RemoteWebDriver, navigate to a URL, and assert the page title.
Selenium Java
WebDriver driver = new RemoteWebDriver(new URL([1]), [2]); driver.get([3]); assertEquals("Example Domain", driver.getTitle());
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong URLs or mixing browser options.
Forgetting to navigate to the URL before asserting title.
✗ Incorrect
Use the Selenium Grid URL, ChromeOptions, and navigate to https://example.com to verify the page title.