RobotFrameWork--selenium2模拟chrome的user agent

${options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()   sys, selenium.webdriver
${options.add_argument}=    Set Variable    user-agent="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36 System/ComputerId" 
Create WebDriver    Chrome  chrome_options=${options}   
Go To   http://www.useragentstring.com
${options}=    Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys, selenium.webdriver
Call Method    ${options}    add_argument    --user-agent=Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36 System/ComputerId
Create WebDriver    Chrome    chrome_options=${options}    
Go To    http://www.useragentstring.com

 

posted @ 2017-04-26 18:14  悠然现南山  阅读(2378)  评论(0编辑  收藏  举报