Bob's Blog

Web开发、测试框架、自动化平台、APP开发、机器学习等

返回上页首页

用safari跑web自动化



做web自动化时,大部分是在chrome上运行,毕竟支持最好。不过偶尔也会有其他主流浏览器的需求(Firefox, IE, Edge, Safari)。

safari其实用得很少,因为最近在重写测试框架,在web的部分需要调试多种浏览器,就在这里再记录一下以免忘记。

其他浏览器就是把浏览器的driver配置在PATH里就可以运行了,对于IE需要修改下注册表:

For IE 11 only, you will need to set a registry entry on the target computer so that the driver can maintain a connection to the instance of Internet Explorer it creates. 
For 64-bit Windows installations, the key is HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BFCACHE. 
Please note that the FEATURE_BFCACHE subkey may or may not be present, and should be created if it is not present. 
Important: Inside this key, create a DWORD value named iexplore.exe with the value of 0.

对于safari,就需要一个mac。safaridriver的路径在/usr/bin/safaridriver,不需要单独下载。

启动safaridriver:safaridriver --enable;然后打开safari,选择reference->advanced,勾选“Show Develop menu in menu bar”,然后在菜单Develop中勾选Allow Remote Automation。

现在就可以启动safari运行web测试了。

对于其他浏览器的driver,我在github上也放了一份能用的,毕竟有时候因为有墙没法下载chromedriver,还可以从github上拉一份,地址是https://github.com/bobjiangps/selenium_browser_drivers

 

 

下一篇:  webdriver中模拟mobile browser的两种方式
上一篇:  windows上git push出现access denied的解决办法

共有0条评论

添加评论

暂无评论