Robot Framework: - 无法从现有的Chrome个人资料中打开Chrome [英] Robot Framework :- Cannot Open Chrome from Existing Chrome Profile
问题描述
以下是我使用goggling后得到的代码,但这并不是从我喜欢的用户数据文件夹中打开Chrome。任何建议或意见,这可以实现。
使用创建WebDriver关键字打开Chrome关键字
[标签] chrome
$ {options} =评估sys.modules ['selenium.webdriver']。ChromeOptions()sys,selenium.webdriver $ b $ {options.add_argument} =设置变量 - 允许运行不安全内容
$ {options.add_argument} =设置变量--disable-web-security
$ {options.add_argument} =设置变量user-data-dir = / Users / myName / AppData / Local / Google / Chrome /用户数据
创建WebDriver Chrome chrome_options = $ {options}
转到{URL}
#关闭浏览器
要添加参数,请调用的 add_argument > ChromeOptions 对象。请注意,您需要在--user-data-dir参数中转义'=',否则Robot Framework将查找名为'--user-data-dir'的参数并失败。当测试这个时,我注意到一个配置文件将在指定的位置创建,如果它不存在。
使用Create WebDriver关键字
$ {options} =评估sys.modules ['selenium.webdriver']。ChromeOptions()sys,selenium.webdriver
调用方法$ {options} add_argument --allow-running-insecure-content
调用方法$ {options} add_argument --disable-web-security
调用方法$ {options} add_argument --user-data-dir\ = / Users / myName / AppData / Local / Google / Chrome /用户数据
创建WebDriver Chrome chrome_options = $ {options}
转至https://stackoverflow.com
I am trying to Learn Robot Framework. I have already worked on Selenium Webdriver. I was trying to open the Chrome Browser from an Exiting Profile using Create Webdriver Keyword. However i am not able to do . It Seems that Robot Framework Opens a new Chrome Profile Everytime. Here is the Code that i got after goggling, but this is not opening Chrome from the User data folder that i prefer. Any Suggestions or Ideas this can be achieved.
Open Chrome Using Create WebDriver Keyword
[Tags] chrome
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
${options.add_argument}= Set Variable --allow-running-insecure-content
${options.add_argument}= Set Variable --disable-web-security
${options.add_argument}= Set Variable user-data-dir = /Users/myName/AppData/Local/Google/Chrome/User Data
Create WebDriver Chrome chrome_options=${options}
go to {URL}
# Close Browser
To add arguments, call the add_argument method of the ChromeOptions object. Note that you need to escape the '=' in the --user-data-dir argument or Robot Framework will look for an argument called '--user-data-dir' and fail. When testing this I noticed that a profile will be created in the location specified if it does not exist.
Open Chrome Using Create WebDriver Keyword
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
Call Method ${options} add_argument --allow-running-insecure-content
Call Method ${options} add_argument --disable-web-security
Call Method ${options} add_argument --user-data-dir\=/Users/myName/AppData/Local/Google/Chrome/User Data
Create WebDriver Chrome chrome_options=${options}
Go To https://stackoverflow.com
这篇关于Robot Framework: - 无法从现有的Chrome个人资料中打开Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!