Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session scoped selenium fixture #176

Closed
adamdorfman opened this issue Jul 26, 2018 · 4 comments
Closed

Session scoped selenium fixture #176

adamdorfman opened this issue Jul 26, 2018 · 4 comments

Comments

@adamdorfman
Copy link

Is there any way I could use this plugin in a session scope. The plugin has been extremely useful, I'm using it to write tests, but I don't want it to close and reopen the browser between every test. Is there any way I could use the selenium fixture in the session scope?

@elyezer
Copy link

elyezer commented Jul 27, 2018

I think it will also be valuable to have module scoped browser as well.

@dsesami
Copy link

dsesami commented Jul 27, 2018

+1 on this. I ran into an issue where I wanted to use the browser instance for a module scope and ended up with the error that i couldn't do so because the selenium fixture scope is only of a function scope, and not configurable to something wider.

@davehunt
Copy link
Contributor

If you have a suggestion for implementing dynamic fixture scopes in pytest then I would be opento adding this. This has been asked for previously (see #59, which includes a somewhat outdated but still feasible workaround).

The main reasons plugin has been implemented to use a browser is for isolation. if using the same browser, one test may leave state such as cookies, cache, etc. that may affect a following test. I am not aware of a way to offer dynamic scopes for fixtures, however I do understand the desire for session and module scoped fixtures. If you have a proposal for a solution then please provide additional details.

I'll leave this issue open for now, however I do consider it a duplicate of #59.

@davehunt
Copy link
Contributor

By the way, if the issue is the browser popping up frequently, I suggest running it in headless mode, inside a Docker container, or on a remote server. If the issue is the overhead in the browser startup, I suggest running your tests in parallel using pytest-xdist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants