我正在Browserstack Automate上用Selenium(Python)远程运行一个测试。在
目标:我想在Browserstack上启动一个会话,登录一个已有的Chrome配置文件。在
所以,第一次做一个新的配置文件是可以的-扫描一次二维码,然后重新使用该配置文件。在
方法:我尝试使用Chrome选项,并为user data dir指定一个参数。这是受到其他几个StackOverflow答案的启发。在
代码:
desired_caps = {
'browser': 'Chrome',
'browser_version': '69.0 beta',
'os': 'Windows',
'os_version': '10',
'resolution': '1024x768',
'browserstack.debug': 'true',
}
desired_caps['browserstack.local'] = True
desired_caps['chromeOptions'] = {}
desired_caps['chromeOptions']['args'] = [r'--user-data-dir=C:\Users\gille\AppData\Local\Google\Chrome\User Data']
driver = webdriver.Remote(command_executor='http://MYBROWSERSTACKHUB', desired_capabilities=desired_caps)
我试图在Browserstack(本地)上运行此程序,但运行时出现以下错误:
“无法初始化类org.openqa.selenium公司.操作系统内核32““
See image with Browserstack error
我尝试指定一个新的随机配置文件,但该配置文件尚不存在,例如:
^{pr2}$但同样的错误出现了。在
(我也尝试过其他不适合我的方法: -保存并重新加载Cookie -更改会话标识和会话url(在Browserstack上不起作用)
我觉得: -或者这可能是Browserstack的问题, -或者我为user data dir包含了错误的路径,应该使用不同的路径,例如chrome_options.add_参数(“用户数据目录=”+操作系统路径目录名(系统argv[0])
但我不熟悉最后一个,所以我不确定下一步该怎么做。 你有什么建议吗?
使用下面的盖子:
相关问题 更多 >
编程相关推荐