0
0
Selenium Javatesting~10 mins

RemoteWebDriver usage 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 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'
A"http://localhost:4444/wd/hub"
B"http://127.0.0.1:5555"
C"https://example.com"
D"ftp://localhost:4444"
Attempts:
3 left
💡 Hint
Common Mistakes
Using an incorrect protocol like ftp.
Using wrong port number or missing /wd/hub path.
2fill in blank
medium

Complete 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'
A"chrome"
B"safari"
C"edge"
D"firefox"
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase letters like "Firefox" which is case-sensitive.
Setting wrong browser names like "firefoxbrowser".
3fill in blank
hard

Fix 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'
Anew ChromeOptions()
BDesiredCapabilities.firefox()
Cnew FirefoxOptions()
Dcapabilities
Attempts:
3 left
💡 Hint
Common Mistakes
Passing DesiredCapabilities object directly causes deprecation warnings or errors.
Using ChromeOptions when Firefox is intended.
4fill in blank
hard

Fill 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'
A"http://localhost:4444/wd/hub"
Bnew FirefoxOptions()
Cnew ChromeOptions()
D"http://127.0.0.1:5555/wd/hub"
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing FirefoxOptions with ChromeOptions.
Using wrong URL or missing /wd/hub path.
5fill in blank
hard

Fill 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'
A"http://localhost:4444/wd/hub"
Bnew ChromeOptions()
C"https://example.com"
D"http://127.0.0.1:5555/wd/hub"
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong URLs or mixing browser options.
Forgetting to navigate to the URL before asserting title.