selenium自动化测试浏览器相关问题

上一篇 / 下一篇  2017-06-14 12:21:09 / 个人分类:selenium

问题一:
运行报错:The path to the driver executable must be set 
by the webdriver.gecko.driver system property
原因:
在selenium3中,使用Firefox,需要添加驱动
解决方式:
从Github上下载驱动程序下载网址-  
https://github.com/mozilla/geckodriver/releases/tag/v0.9.0
并在代码中加入:System.setProperty("webdriver.firefox.marionette","C:\\Program Files (x86)\\Mozilla Firefox\\geckodriver.exe");
其中C:\\Program Files (x86)\\Mozilla Firefox\\geckodriver.exe是驱动放置的位置
详见:http://www.cnblogs.com/my-blogs-for-everone/p/5986915.html
问题二:解决了问题一,但是能打开浏览器打不开对应url
原因:
使用的浏览器版本与selenium版本不兼容,
解决方法:
当前使用的是selenium webdriver3和firefox53,将浏览器版本退回到45后,测试脚本运行通过 
  低版本浏览器下载地址:
火狐的FTP服务器http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/

TAG: 浏览器

 

评分:0

我来说两句

Open Toolbar