由于open browser的参数只有一个ff_profile_dir,所以不能指定chrome profile。
只能通过python 传递lang这个参数去改变语言。
python:
from selenium import webdriver
from time import sleep
driver_location = "E:\Python27\chromedriver.exe"
options = webdriver.ChromeOptions()
options.add_argument('--lang=ja')
driver = webdriver.Chrome(executable_path=driver_location, chrome_options=options)
driver.get("https://aws-qa5.infaqa.com/ma/login")
sleep(3000)
driver.quit()
Robot Framwork:
参考https://github.com/robotframework/Selenium2Library/issues/529
https://groups.google.com/forum/#!msg/robotframework-users/r3rxgSv1Cs0/rzzc1fmwEQAJ
| Open URL in Google Chrome | [Arguments] | ${url} | | [Documentation] | Starts the Google Chrome browser. | | ${options}= | Evaluate | sys.modules['selenium.webdriver'].ChromeOptions() | sys | | Call Method | ${options} | add_argument | --lang=de | | Create WebDriver | Chrome | chrome_options=${options} | | Go To | ${url}
${options} Evaluate sys.modules['selenium.webdriver'].ChromeOptions()
Call Method ${options} add_argument
Create Webdriver Chrome chrome_options=${options}
Go To https://aws-qa5.infaqa.com/ma/