Bird
Raised Fist0
Selenium Javatesting~20 mins

EdgeOptions configuration in Selenium Java - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
EdgeOptions Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate
2:00remaining
What is the output of this EdgeOptions configuration code?
Consider the following Java Selenium code snippet configuring EdgeOptions. What will be the value of the 'headless' argument in the EdgeOptions after execution?
Selenium Java
import org.openqa.selenium.edge.EdgeOptions;

public class TestEdgeOptions {
    public static void main(String[] args) {
        EdgeOptions options = new EdgeOptions();
        options.addArguments("--headless");
        options.addArguments("--disable-gpu");
        System.out.println(options.getArguments().contains("--headless"));
    }
}
ACompilation error
Bfalse
Ctrue
DRuntime exception
Attempts:
2 left
💡 Hint
Check how EdgeOptions stores and retrieves arguments.
❓ assertion
intermediate
2:00remaining
Which assertion correctly verifies EdgeOptions has 'start-maximized' argument?
Given an EdgeOptions object named 'options' with 'start-maximized' argument added, which assertion correctly checks this in a JUnit test?
Selenium Java
EdgeOptions options = new EdgeOptions();
options.addArguments("start-maximized");
AassertTrue(options.getArguments().contains("start-maximized"));
BassertFalse(options.getArguments().contains("start-maximized"));
CassertEquals(options.getArguments(), "start-maximized");
DassertNull(options.getArguments());
Attempts:
2 left
💡 Hint
Check the type returned by getArguments() and how to verify list contents.
🔧 Debug
advanced
2:00remaining
Why does this EdgeOptions code throw an IllegalArgumentException?
Examine the code below. Why does it throw an IllegalArgumentException at runtime?
Selenium Java
EdgeOptions options = new EdgeOptions();
options.addArguments(null);
ABecause EdgeOptions must be initialized with a WebDriver instance first.
BBecause addArguments() expects a list, not a single string.
CBecause the code is missing a required import statement.
DBecause addArguments() does not accept null and throws IllegalArgumentException.
Attempts:
2 left
💡 Hint
Check the method contract for addArguments() regarding null values.
🧠 Conceptual
advanced
2:00remaining
What is the effect of setting EdgeOptions.setPageLoadStrategy(PageLoadStrategy.NONE)?
In Selenium EdgeOptions, what does setting the page load strategy to NONE do during page navigation?
AThe driver does not wait for any page loading; commands proceed immediately after navigation starts.
BThe driver waits until the entire page including images and scripts is fully loaded.
CThe driver waits only for the DOMContentLoaded event before proceeding.
DThe driver throws an error if the page takes longer than default timeout to load.
Attempts:
2 left
💡 Hint
Think about how page load strategies affect waiting behavior.
❓ framework
expert
3:00remaining
Which EdgeOptions configuration enables running tests with a custom user profile directory?
You want to run Edge browser tests using a specific user profile directory located at 'C:\Users\TestUser\EdgeProfile'. Which EdgeOptions code snippet correctly sets this?
Aoptions.setProfile("C:\\Users\\TestUser\\EdgeProfile");
Boptions.addArguments("--user-data-dir=C:\\Users\\TestUser\\EdgeProfile");
Coptions.setCapability("user-data-dir", "C:\\Users\\TestUser\\EdgeProfile");
Doptions.addArguments("user-data-dir=C:\\Users\\TestUser\\EdgeProfile");
Attempts:
2 left
💡 Hint
Check the correct argument format for user data directory in EdgeOptions.

Practice

(1/5)
1. What is the primary purpose of using EdgeOptions in Selenium Java tests?
easy
A. To customize Microsoft Edge browser settings before launching it
B. To write test assertions for Edge browser
C. To locate web elements on the Edge browser page
D. To generate test reports for Edge browser tests

Solution

  1. Step 1: Understand EdgeOptions role

    EdgeOptions is used to set browser preferences and configurations before starting Edge.
  2. Step 2: Differentiate from other test tasks

    Assertions, locating elements, and reporting are separate tasks not handled by EdgeOptions.
  3. Final Answer:

    To customize Microsoft Edge browser settings before launching it -> Option A
  4. Quick Check:

    EdgeOptions = browser setup [OK]
Hint: EdgeOptions sets browser settings before launch [OK]
Common Mistakes:
  • Confusing EdgeOptions with assertion or locator classes
  • Thinking EdgeOptions generates reports
  • Using EdgeOptions to find elements
2. Which of the following is the correct way to add the argument --headless to an EdgeOptions object in Java?
easy
A. options.addArguments("--headless");
B. options.setArguments("--headless");
C. options.addArgument("headless");
D. options.setCapability("headless", true);

Solution

  1. Step 1: Recall method to add arguments

    The correct method to add command-line arguments is addArguments(String... args).
  2. Step 2: Check argument format

    The argument must be "--headless" with two dashes, matching browser flags.
  3. Final Answer:

    options.addArguments("--headless"); -> Option A
  4. Quick Check:

    Use addArguments("--headless") [OK]
Hint: Use addArguments with double dashes for flags [OK]
Common Mistakes:
  • Using setArguments instead of addArguments
  • Missing dashes in argument string
  • Confusing addArgument (singular) which doesn't exist
3. Given the following code snippet, what will be the effect on the Edge browser when launched?
EdgeOptions options = new EdgeOptions();
options.addArguments("--disable-gpu");
options.setCapability("acceptInsecureCerts", true);
EdgeDriver driver = new EdgeDriver(options);
medium
A. The browser runs with GPU enabled and rejects insecure certificates
B. The browser runs in headless mode and blocks insecure certificates
C. The browser disables GPU hardware acceleration and accepts insecure SSL certificates
D. The browser disables GPU and runs with default SSL certificate settings

Solution

  1. Step 1: Analyze addArguments call

    Adding "--disable-gpu" disables GPU hardware acceleration in Edge.
  2. Step 2: Analyze setCapability call

    Setting "acceptInsecureCerts" to true allows the browser to accept insecure SSL certificates.
  3. Final Answer:

    The browser disables GPU hardware acceleration and accepts insecure SSL certificates -> Option C
  4. Quick Check:

    Disable GPU + accept insecure certs = The browser disables GPU hardware acceleration and accepts insecure SSL certificates [OK]
Hint: Check argument effects and capability flags carefully [OK]
Common Mistakes:
  • Confusing headless mode with disable-gpu
  • Assuming default SSL behavior without checking capability
  • Ignoring the effect of setCapability on SSL
4. Identify the error in the following EdgeOptions configuration code:
EdgeOptions options = new EdgeOptions();
options.addArguments("headless");
options.setCapability("acceptInsecureCerts", "true");
EdgeDriver driver = new EdgeDriver(options);
medium
A. addArguments should be replaced with setArguments and acceptInsecureCerts is correct
B. The argument "headless" is missing dashes and acceptInsecureCerts should be boolean, not string
C. EdgeOptions cannot set capabilities, use DesiredCapabilities instead
D. No error, code will run correctly

Solution

  1. Step 1: Check argument format

    "headless" argument must be "--headless" with two dashes to work properly.
  2. Step 2: Check capability value type

    "acceptInsecureCerts" expects a boolean value, not a string "true".
  3. Final Answer:

    The argument "headless" is missing dashes and acceptInsecureCerts should be boolean, not string -> Option B
  4. Quick Check:

    Arguments need dashes + boolean capability [OK]
Hint: Arguments need dashes; booleans not strings for capabilities [OK]
Common Mistakes:
  • Using string "true" instead of boolean true
  • Missing dashes in command-line arguments
  • Thinking setArguments exists instead of addArguments
5. You want to configure EdgeOptions to run tests in headless mode, disable extensions, and accept insecure certificates. Which code snippet correctly achieves this?
hard
A. EdgeOptions options = new EdgeOptions(); options.addArguments("--headless"); options.addArguments("disable-extensions"); options.setCapability("acceptInsecureCerts", false);
B. EdgeOptions options = new EdgeOptions(); options.addArguments("headless", "disable-extensions"); options.setCapability("acceptInsecureCerts", "true");
C. EdgeOptions options = new EdgeOptions(); options.setArguments("--headless", "--disable-extensions"); options.setCapability("acceptInsecureCerts", true);
D. EdgeOptions options = new EdgeOptions(); options.addArguments("--headless", "--disable-extensions"); options.setCapability("acceptInsecureCerts", true);

Solution

  1. Step 1: Verify argument syntax

    Arguments must have double dashes and be passed correctly. EdgeOptions options = new EdgeOptions(); options.addArguments("--headless", "--disable-extensions"); options.setCapability("acceptInsecureCerts", true); uses "--headless" and "--disable-extensions" properly.
  2. Step 2: Check capability for insecure certs

    Capability "acceptInsecureCerts" must be boolean true to accept insecure certificates, as in EdgeOptions options = new EdgeOptions(); options.addArguments("--headless", "--disable-extensions"); options.setCapability("acceptInsecureCerts", true);.
  3. Step 3: Confirm no syntax errors

    EdgeOptions options = new EdgeOptions(); options.addArguments("--headless", "--disable-extensions"); options.setCapability("acceptInsecureCerts", true); uses correct methods and types; others have missing dashes, wrong method names, or wrong boolean values.
  4. Final Answer:

    EdgeOptions options = new EdgeOptions(); options.addArguments("--headless", "--disable-extensions"); options.setCapability("acceptInsecureCerts", true); -> Option D
  5. Quick Check:

    Correct args + boolean capability = EdgeOptions options = new EdgeOptions(); options.addArguments("--headless", "--disable-extensions"); options.setCapability("acceptInsecureCerts", true); [OK]
Hint: Use addArguments with dashes and boolean for capabilities [OK]
Common Mistakes:
  • Missing dashes in arguments
  • Passing string instead of boolean for capabilities
  • Using non-existent setArguments method
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard