S
S
sinneren2018-07-02 09:07:16
Java
sinneren, 2018-07-02 09:07:16

Why do 2 browsers open when running a test?

@Before
    public void prepareData() {
        FirefoxBinary firefoxBinary = new FirefoxBinary();
        //firefoxBinary.addCommandLineOptions("--headless");
        FirefoxOptions firefoxOptions = new FirefoxOptions();
        firefoxOptions.setBinary(firefoxBinary);

        driver = new FirefoxDriver(firefoxOptions);
    }

    @Given("^пользователь на странице \"([^\"]*)\"$")
    public void setPage(String url) {
        driver.get(url);
        driver.manage().window().maximize();
        driver.manage().timeouts().implicitlyWait(4,
                TimeUnit.SECONDS);
    }

With this code, an empty browser is launched first, and then a 2nd window where all actions are performed. Is this normal and how to avoid if not.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
azShoo, 2018-07-02
@sinneren

Most likely, you are initializing the webdriver twice
Here
> FirefoxBinary firefoxBinary = new FirefoxBinary();
and here
> driver = new FirefoxDriver(firefoxOptions);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question