我们正在使用Protractor(5.2.2),基于chrome的功能测试。请参阅配置信息。
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
getPageTimeout: 1000,
allScriptsTimeout: 3000,
framework: 'custom',
verbose:'true',
frameworkPath: require.resolve('../../node_modules/protractor-cucumber-framework'),
ignoreUncaughtExceptions: true,
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['--disable-web-security'],
'mobileEmulation': {
'deviceName': 'Nexus 6'
}
}
}
我们的测试脚本在过去4个月内没有任何问题,突然从12月17日起,所有element.all(by.css('')).click()
都停止了工作。当它尝试执行此方法一段时间后,我可以看到浏览器右键单击菜单而不是元素单击。
请帮我解决这个问题。
答案 0 :(得分:0)
我通过将chromeOptions指向user-agent而不是mobileEmulation进行了解决,测试脚本运行正常。
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
'args': ['user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 8_0_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12A405 Safari/600.1.4']
}
},
and set the browser size - browser.manage().window().setSize(375, 667);