Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a FirefoxOptions object.
Selenium Java
FirefoxOptions options = new [1](); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ChromeOptions instead of FirefoxOptions.
Using FirefoxDriver instead of FirefoxOptions.
✗ Incorrect
You create a FirefoxOptions object by calling its constructor: new FirefoxOptions().
2fill in blank
mediumComplete the code to set Firefox to run in headless mode.
Selenium Java
options.[1](true); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method name that does not exist like setHeadlessMode.
Trying to set a property directly instead of using the method.
✗ Incorrect
The method to enable headless mode in FirefoxOptions is setHeadless(true).
3fill in blank
hardFix the error in the code to add an argument to FirefoxOptions.
Selenium Java
options.addArguments([1]); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the argument without quotes.
Using single quotes instead of double quotes.
✗ Incorrect
The argument must be a string literal with double quotes in Java, so use "--disable-gpu".
4fill in blank
hardFill both blanks to create FirefoxOptions and set it to accept insecure certificates.
Selenium Java
FirefoxOptions options = new [1](); options.[2](true);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using FirefoxDriver instead of FirefoxOptions.
Using setHeadless instead of setAcceptInsecureCerts.
✗ Incorrect
You create FirefoxOptions with new FirefoxOptions() and enable accepting insecure certs with setAcceptInsecureCerts(true).
5fill in blank
hardFill all three blanks to create FirefoxOptions, set headless mode, and add a custom argument.
Selenium Java
FirefoxOptions options = new [1](); options.[2](true); options.addArguments([3]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names or missing quotes around the argument.
Confusing setAcceptInsecureCerts with setHeadless.
✗ Incorrect
Create FirefoxOptions with new FirefoxOptions(), enable headless mode with setHeadless(true), and add the argument as a string with addArguments("--window-size=1920,1080").