相关文章推荐

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 [🐛 Bug]: selenium.common.exceptions.SessionNotCreatedException: Message: session not created exception: Missing or invalid capabilities #12524 [🐛 Bug]: selenium.common.exceptions.SessionNotCreatedException: Message: session not created exception: Missing or invalid capabilities #12524 bhawna0612 opened this issue Aug 9, 2023 · 2 comments

What happened?

Trying to run the Selenium Python script using pytest framework. My interpreter is set to python 310 but when running the code the chromedriver.exe version is picked from python 27.

So getting the below warning. How to overcome this issue.

My Selenium version is 4.11.2 and Chrome browser version is 115.0.5790.171

How Selenium Manager looks for the installed drivers?

How can we reproduce the issue?

@pytest.fixture(scope='session')
def driverObject(request):
    global driver
    sys.path.insert(0, os.getcwd())
    browser = option.browser
    if browser in 'firefox':
        driver = webdriver.Firefox()
    else:
        options = webdriver.ChromeOptions()
        options.add_experimental_option('excludeSwitches', ['enable-logging'])
        driver = webdriver.Chrome(options=options)
        driver.get_log('browser')
    driver.maximize_window()
    driver.implicitly_wait(20)
    return driver
def test_valid_login(driverObject):
login(driver, url, clientId, username, password, app)

Relevant log output

selenium.common.exceptions.SessionNotCreatedException: Message: session not created exception: Missing or invalid capabilities
E         (Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.19044 x86_64)
..\..\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py:229: SessionNotCreatedException
--------------------------------------------------------------------------------------------------------- Captured log setup ---------------------------------------------------------------------------------------------------------- 
WARNING  selenium.webdriver.common.selenium_manager:selenium_manager.py:133 The chromedriver version (2.41.578737) detected in PATH at C:\Python27\Scripts\chromedriver.exe might not be compatible with the detected chrome version (11
5.0.5790.170); currently, chromedriver 115.0.5790.170 is recommended for chrome 115.*, so it is advised to delete the driver in PATH and retry
======================================================================================================= short test summary info ======================================================================================================= 
ERROR test_cases/test_login/test_valid_login.py::test_valid_login - selenium.common.exceptions.SessionNotCreatedException: Message: session not created exception: Missing or invalid capabilities

Operating System

Windows 10

Selenium version

4.11.2

What are the browser(s) and version(s) where you see this issue?

Chrome 115.0.5790.171

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver

Are you using Selenium Grid?

@bhawna0612 , thank you for creating this issue. We will troubleshoot it as soon as we can.

Info for maintainers Triage this issue by using labels. If information is missing, add a helpful comment and then I-issue-template label. If the issue is a question, add the I-question label. If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label. If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue. After troubleshooting the issue, please add the R-awaiting answer label. Thank you!
 
推荐文章