pytest-splinter icon indicating copy to clipboard operation
pytest-splinter copied to clipboard

Deprecation warning with headless fixture : how to use Splinter config

Open Ruff9 opened this issue 2 years ago • 4 comments

I'm using the splinter_headless() fixture, and I get this warning :

.../venv/lib/python3.10/site-packages/splinter/browser.py:92: DeprecationWarning:
Sending fullscreen, incognito, headless, user_agent to the browser object has been deprecated.
Please pass in a Splinter Config object instead.See: https://splinter.readthedocs.io/en/latest/config.html
for more details
    return driver(config=config, *args, **kwargs)

How can I use a Config object with pytest-splinter ?

Ruff9 avatar Nov 22 '23 17:11 Ruff9

This warning comes clearly from splinter code. This is pytest-splinter repository.

pytest-splinter is a thin layer over splinter to make it work easier with splinter.

Please report this bug in splinter repository.

mpasternak avatar Nov 23 '23 13:11 mpasternak

After giving it a second of thought more, I see that this is rather pytest-splinter problem. Sorry, @Ruff9 I misunderstood you.

mpasternak avatar Nov 23 '23 13:11 mpasternak

How about you use splinter_driver_kwargs? Documented here: https://github.com/pytest-dev/pytest-splinter

mpasternak avatar Nov 23 '23 13:11 mpasternak

I just tried using

@pytest.fixture(scope='session')
def splinter_driver_kwargs():
    return {"headless": True}

instead of

@pytest.fixture(scope='session')
def splinter_headless():
    return True

and the warning is still there. Both are working though, the browser is indeed headless with both fixtures. I can work with that.

But to remove the warning, I would need to use a Config object, as the warning says. And I see no mention of it in the pytest-splinter docs.

Ruff9 avatar Nov 23 '23 15:11 Ruff9