# NiceGUI

[Button: icon:menu]

[](/)

[Installation](/#installation)

[Features](/#features)

[Demos](/#demos)

[Documentation](/documentation)

[Examples](/examples)

[Why?](/#why)

[Button]

[Button]

[](https://github.com/zauberzeug/nicegui/)

[Button: icon:more_vert]

# Screen Fixture

## Screen Fixture


        The `screen` fixture starts a real (headless) browser to interact with your application.
        This is only necessary if you have browser-specific behavior to test.
        NiceGUI itself is thoroughly tested with this fixture to ensure each component works as expected.
        Therefore we recommend to only use it if you absolutely have to.
    

example

[Button]

````python
from selenium.webdriver.common.keys import Keys

screen.open('/')
screen.type(Keys.TAB) # to focus on the first input
screen.type('user1')
screen.type(Keys.TAB) # to focus the second input
screen.type('pass1')
screen.click('Log in')
screen.should_contain('Hello user1!')
screen.click('logout')
screen.should_contain('Log in')

````

## Configuration


    The `screen` fixture can be configured by setting the following static attributes:

    - `PORT`: The port to use for the server (default: automatically determined free port).
    - `IMPLICIT_WAIT`: The implicit wait time in seconds (default: 4).
    - `SCREENSHOT_DIR`: The directory to store the screenshots
        (default: `./screenshots/<pid>`, a per-process subdirectory so parallel `pytest` invocations do not collide).
    - `CATCH_JS_ERRORS`: Whether to catch JavaScript errors (default: `True`, *added in version 3.2.0*).


## Web driver


        The `screen` fixture uses Selenium under the hood.
        Currently it is only tested with the Chrome driver.
        To automatically use it for the tests we suggest to add the option `--driver Chrome` to your `pytest.ini`:
    

pytest.ini

[Button]

````ini
[pytest]
asyncio_mode = auto
addopts = "--driver Chrome"

````

## Reference

**Nice**GUI

The Python UI framework that shows up in your browser.

[](https://github.com/zauberzeug/nicegui/)

[](https://discord.gg/TEpFeAaF4f)

[](https://www.reddit.com/r/nicegui/)

Resources

[Documentation](/documentation)

[Examples](/examples)

[LLM reference](/llms.txt)

[GitHub](https://github.com/zauberzeug/nicegui/)

[PyPI](https://pypi.org/project/nicegui/)

Community

[Discussions](https://github.com/zauberzeug/nicegui/discussions)

[Discord](https://discord.gg/TEpFeAaF4f)

[Reddit](https://www.reddit.com/r/nicegui/)

[Contributing](https://github.com/zauberzeug/nicegui/blob/main/CONTRIBUTING.md)

[Sponsors](https://github.com/sponsors/zauberzeug)

Legal

[Imprint](/imprint_privacy#imprint)

[Privacy](/imprint_privacy#privacy)

Made with NiceGUI by [Zauberzeug](https://zauberzeug.com)

© 2026 [Zauberzeug GmbH](https://zauberzeug.com)