Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/306.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.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 使用机器人框架禁用Chrome扩展';s开放浏览器方法_Python_Python 2.7_Selenium Webdriver_Selenium Chromedriver_Robotframework - Fatal编程技术网

Python 使用机器人框架禁用Chrome扩展';s开放浏览器方法

Python 使用机器人框架禁用Chrome扩展';s开放浏览器方法,python,python-2.7,selenium-webdriver,selenium-chromedriver,robotframework,Python,Python 2.7,Selenium Webdriver,Selenium Chromedriver,Robotframework,我需要打开Chrome Maximized的一个实验性选项,以防止弹出关于扩展“被管理员禁用”的警告 使用CreateWebDriver,我可以使用 Open Chrome With Options ${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver Call Method ${options} add_experimental

我需要打开Chrome Maximized的一个实验性选项,以防止弹出关于扩展“被管理员禁用”的警告

使用CreateWebDriver,我可以使用

Open Chrome With Options
  ${options}=  Evaluate  sys.modules['selenium.webdriver'].ChromeOptions()  sys, selenium.webdriver
  Call Method       ${options}    add_experimental_option      useAutomationExtension    ${FALSE}
  Call Method       ${options}    add_argument      start-maximized
  Create WebDriver  Chrome    chrome_options=${options}
  Go To             ${HOMEPAGE}
但是,当我尝试使用Open Browser(如下所示)进行等效操作时,尽管“useAutomationExtension”正在工作,但会忽略“开始最大化”设置。为什么会这样

Open Chrome with Capabilities
  ${args}=              Create List   start-maximised
  ${chrome_options}=    Create Dictionary
  ...    useAutomationExtension     ${FALSE}
  ...    args                       ${args}
  ${capabilities}=     Create Dictionary
  ...    chromeOptions    ${chrome_options}
  Open Browser  ${HOMEPAGE}  ${BROWSER}    desired_capabilities=${capabilities}

所需功能和chrome选项是两种不同的配置。关键字“Open Browser”不支持chrome选项,因此向chrome添加选项的唯一方法是通过关键字“Create WebDriver”

所需的功能和chrome选项是两种不同的配置。关键字“Open Browser”不支持chrome选项,因此向chrome添加选项的唯一方法是通过关键字“Create WebDriver”

您需要添加列表中的所有参数。然后将此列表传递给Dictionary对象,并将其传递给打开浏览器

所有chrome选项都需要作为dictionary对象传递,以打开具有关键所需功能的浏览器

${options}=创建列表--启动最大化--禁用web安全
${arguments}=创建字典args=${options}
${capabilities}=Create Dictionary chromeOptions=${arguments}
打开浏览器https://www.google.com    远程\u url=${grid\u url}浏览器=${browser}所需的\u功能=${capabilities}

您需要在列表中添加所有参数。然后将此列表传递给Dictionary对象,并将其传递给打开浏览器

所有chrome选项都需要作为dictionary对象传递,以打开具有关键所需功能的浏览器

${options}=创建列表--启动最大化--禁用web安全
${arguments}=创建字典args=${options}
${capabilities}=Create Dictionary chromeOptions=${arguments}
打开浏览器https://www.google.com    远程\u url=${grid\u url}浏览器=${browser}所需的\u功能=${capabilities}
${options} =     Create List    --start-maximized    --disable-web-security <<any options that you need to add>>
${arguments} =     Create Dictionary    args=${options}
${capabilities} =     Create Dictionary    chromeOptions=${arguments}
Open Browser    https://www.google.com    remote_url=${grid_url}    browser=${BROWSER}    desired_capabilities=${capabilities}