Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/fsharp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Selenium:TypeError:uuu init_uuuuuuuuuuuuuuuuuuu()获得了一个意外的关键字参数';可执行路径';_Python_Selenium_Selenium Webdriver - Fatal编程技术网

Python Selenium:TypeError:uuu init_uuuuuuuuuuuuuuuuuuu()获得了一个意外的关键字参数';可执行路径';

Python Selenium:TypeError:uuu init_uuuuuuuuuuuuuuuuuuu()获得了一个意外的关键字参数';可执行路径';,python,selenium,selenium-webdriver,Python,Selenium,Selenium Webdriver,我正在尝试在heroku上运行selenium chromedriver,方法是: def create_chromedriver(ua=False): options = webdriver.ChromeOptions() CHROMEDRIVER_PATH = os.getenv('$HOME') or basedir+'/chromedriver.exe' FLASK_CONFIG = os.getenv('FLASK_CONFIG') if FLASK_

我正在尝试在heroku上运行selenium chromedriver,方法是:

def create_chromedriver(ua=False):
    options = webdriver.ChromeOptions()
    CHROMEDRIVER_PATH = os.getenv('$HOME') or basedir+'/chromedriver.exe'
    FLASK_CONFIG = os.getenv('FLASK_CONFIG')

    if FLASK_CONFIG and FLASK_CONFIG == "production":
        CHROMEDRIVER_PATH = '/app/.chromedriver/bin/chromedriver'
        GOOGLE_CHROME_SHIM = os.getenv('$GOOGLE_CHROME_SHIM') or 'no path found'
        options.binary_location = '/app/.apt/usr/bin/google-chrome'

        options.add_argument("--start-maximized")
        options.add_argument("--disable-infobars")
        options.add_argument("--disable-extensions")
        options.add_argument("--no-sandbox")
        options.add_argument("--disable-dev-shm-usage")

    if ua:
        mobile_emulation =  {"deviceName": "Nexus 5"}
        options.add_experimental_option("mobileEmulation", mobile_emulation)

        options.add_argument("--headless")
        options.add_argument("--disable-gpu")

        capabilities = options.to_capabilities()


    return webdriver.Remote(executable_path=CHROMEDRIVER_PATH, command_executor='http://127.0.0.1:4444/wd/hub',
                      desired_capabilities=options.to_capabilities())
当我跑步时:

def some_long_calculation():
    driver = create_chromedriver('test')
    # driver = create_chromedriver()
    print(driver.capabilities['version'])

    driver.get("https://www.yahoo.com/")
我得到了截图。错误日志提供:

  2018-07-24T20:20:58.078553+00:00 app[web.1]: TypeError: __init__() got an unexpected keyword argument 'executable_path'

我如何在这里设置chromedriver的路径?

在这里,我不知道在哪里?这个函数
create\u chromedriver
在哪里?很抱歉,尝试一下。远程
\u init\u()
不接受
可执行路径作为参数。发生的异常非常清楚。明白了,但是如何将chromedriver的路径设置为Remote?