[英]Disable Chrome extensions with Robot Framework's Open Browser method
I need to open Chrome maximised with an experimental option to prevent a pop warning about extensions "disabled by your administrator". 我需要使用实验性选项将Chrome最大化打开,以防止弹出有关扩展名“由管理员禁用”的警告。
Using Create WebDriver, I can get this working with 使用Create WebDriver,我可以将其与
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}
However, when I try something equivalent with Open Browser (see below), although the "useAutomationExtension" is working, the start-maximised setting is ignored. 但是,当我尝试使用与“打开浏览器”等效的方法(见下文)时,尽管“ useAutomationExtension”正在工作,但开始最大值设置将被忽略。 Why is this?
为什么是这样?
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}
Desired capabilities and chrome options are two different configurations. 所需功能和镶边选项是两种不同的配置。 The keyword "Open Browser" doesn't support chrome options, so the only way to add options to chrome is by keywords "Create WebDriver"
关键字“打开浏览器”不支持chrome选项,因此向chrome添加选项的唯一方法是通过关键字“ Create WebDriver”
You need to add all the params in the list. 您需要在列表中添加所有参数。 Then pass this list to Dictionary object and pass it to open a browser.
然后将此列表传递给Dictionary对象,并将其传递给打开浏览器。
All the chrome options need to be passed as a dictionary object to Open Browser with key desired_capabilities. 所有的chrome选项都需要作为字典对象传递给具有所需的关键功能的Open Browser。
Ex. 防爆。
${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}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.