robot framework切换chrome到手机模式
Robot framework中的代码如下:
登录
[Arguments] ${account} ${password}
${devname} Create Dictionary deviceName=Nexus 5
${mobile_emulation} Create Dictionary mobileEmulation=${devname}
${chromeoptions} Evaluate sys.modules['selenium.webdriver.chrome.options'].Options() sys, selenium.webdriver.chrome.options
${chromeoptions._experimental_options} Set Variable ${mobile_emulation}
Call Method ${chromeoptions} add_experimental_option mobileEmulation ${devname}
Create Webdriver Chrome chrome_options=${chromeoptions}
go to http://m.youzhonglian.cn/partner/shop/mgr
sleep 5
click element name=loginName
input text name=loginName ${account}
click element name=password
input text name=password ${password}
click element id=login
sleep 3