我正在尝试使用selenium2Library在机器人中打开我们的windows Chrome exe。我试着用这段代码使用Create webdriver创建一个Webdriver,但它不起作用。
${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver.chrome.options
${options.add_extension}= Set_Variable path/to/extension
Create WebDriver Chrome chrome_options=${options}在Python中,我这样做...它在selenium中启动我的应用程序。
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.action_chains import ActionChains
def chromedr():
chrome_options = Options()
chrome_options.binary_location = 'C:/Program Files (x86)/InTouch Health/Carestation/Carestation.exe'
driver = webdriver.Chrome('C:/Program Files (x86)/InTouch Health/Carestation/chromedriver.exe', chrome_options=chrome_options)
return driver如何在Robot/selenium2Library中执行此操作?
我能够使用以下代码启动应用程序:${options}= Evaluate sys.modules'selenium.webdriver'.ChromeOptions() sys,selenium.webdriver Create WebDriver Chrome my_alias chrome_options=${options} executable_path=C:/程序文件(x86)/Myapp.exe
发布于 2017-11-06 14:13:50
使用robotframework selenium2library打开chrome
1)通过pip安装selenium2Library
2)下载并解压Chrome驱动exe,添加到环境变量中
3)你可以像下面这样调用chrome
*** Settings ***
Library Selenium2Library
*** Variables ***
${SiteUrl} https://stackoverflow.com
${Browser} Chrome
*** Test Cases ***
Test
Open Browser and login
*** Keywords ***
Open Browser and login
open browser ${SiteUrl} ${Browser} https://stackoverflow.com/questions/47084454
复制相似问题