WebDriverException: Message: newSession with GeckoDriver Firefox v65 and Selenium through Python 3.7

感情迁移 提交于 2019-11-28 02:21:32

Not sure where things are going wrong but there seems to be a mixup with multiple binary versions. However I am using the following configuration:

  • Python: 3.6.1

    C:\Users\user_name>python
    Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
    
  • Selenium: 3.141.0

    C:\Users\user_name>pip show -V selenium
    Name: selenium
    Version: 3.141.0
    Summary: Python bindings for Selenium
    Home-page: https://github.com/SeleniumHQ/selenium/
    Author: UNKNOWN
    Author-email: UNKNOWN
    License: Apache 2.0
    Location: c:\python\lib\site-packages
    Requires: urllib3
    Required-by:
    
  • GeckoDriver: 0.24.0

    C:\Utility\BrowserDrivers>geckodriver.exe -V
    geckodriver 0.24.0 ( 2019-01-28)
    
    The source code of this program is available from
    testing/geckodriver in https://hg.mozilla.org/mozilla-central.
    
    This program is subject to the terms of the Mozilla Public License 2.0.
    You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.
    
  • Firefox: Mozilla Firefox 65.0

    C:\Program Files\Mozilla Firefox>firefox -v |more
    Mozilla Firefox 65.0
    

I have taken your own code and executed it adding the argument executable_path as follows:

  • Code Block:

    from selenium import webdriver
    
    with webdriver.Firefox(executable_path=r'C:\Utility\BrowserDrivers\geckodriver.exe') as driver:
        driver.get("http://google.com")
        print("Page Title is : %s" %driver.title)
        driver.quit()
    
  • Console Output:

    Page Title is : Google
    

As a thumb rule always follow the configuration matrix from the GeckoDriver, Selenium and Firefox Browser compatibility chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!