Pytest error: You tried to access the function scoped fixture "browser" with a session scoped request object #10667
Unanswered
amanueltrutag
asked this question in
Q&A
Replies: 1 comment 2 replies
-
It could be many things.
Extra tips
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello all,
I was trying to use a session based test fixture for selenium tests but I am getting the error message :
"You tried to access the function scoped fixture browser with a session scoped request object".
It works fine if the fixture scope is defined as "function" but then it will keep initializing the webdriver for every test module. I wanted to have it initialized once, and pass it to all the test functions in the different test modules. Below is the code:
Contents of my Conftest.py file
Contents of my test_1_login_page.py
when running pytest, I call it from the command line and pass the parameters there as shown:
but I get the error message:
Any suggestions on what I can fix this?
Beta Was this translation helpful? Give feedback.
All reactions