seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
4.46k stars 909 forks source link

Ubuntu Linux error while running my_first_test.py #2800

Closed dwk601 closed 1 month ago

dwk601 commented 1 month ago
argparse.ArgumentError: argument --browser: conflicting option string: --browser

i just set the env with python and install all requirements and run the pytest and this error shows up

mdmintz commented 1 month ago

Duplicate of https://github.com/seleniumbase/SeleniumBase/discussions/976#discussioncomment-1259611

That error occurs when the same pytest command-line argument is being defined in more than two places. Have you previously installed a framework that has --browser defined as one of the available options? Or are you trying to define extra arguments in a custom conftest.py file? You can get around this by installing SeleniumBase in a new virtual environment if you can't figure out where the other definitions are defined. Or if you can find the other location where --browser is defined, then just remove that definition. If another framework/library has it, pip uninstall it. Command-line arguments can only be defined once per argument.

Alternatively, use pynose as a temporary fix to run tests until you've removed the duplicate definition. Eg. pynose my_first_test.py. (nosetests works the same.) (That is already included with recent versions of SeleniumBase.)