淘宝商城(天猫)高级技术专家.3年研发+3年性能测试调优/系统测试+4年团队管理与测试架构、研发系统实践. 新舞台新气象, 深化测试基础架构及研发架构,希望能在某个技术领域成为真正的技术大牛。欢迎荐才http://bbs.51testing.com/viewthread.php?tid=120496&extra=&page=1 .邮件: jianzhao.liangjz@alibaba-inc.com,MSN:liangjianzhao@163.com.微博:http://t.sina.com.cn/1674816524

selenium 和webdriver_入门实践

上一篇 / 下一篇  2010-04-01 20:38:01 / 个人分类:自动化测试框架实现与优化

   我们一直非常强调建立以底层为核心的分层自动化测试体系,虽然web ui自动化在破页、美感方面不值得投入,但是由于目前大量业务逻辑在web ui,所以合适的web ui测试自动比率也是非常关键的。


  watir设计理念和selenium有很大差异。watir便于测试工程师快速上手,对ie支持非常好;而selenium擅长浏览器兼容性。

   参考:

http://code.google.com/p/meimei/wiki/SeleniumUsage

http://blog.csdn.net/shendl/archive/2009/03/08/3969750.aspx

http://blog.csdn.net/shendl/archive/2009/03/08/3969750.aspx

http://www.ibm.com/developerworks/cn/java/j-lo-selenium/

http://www.onlymarshall.com/tag/selenium/

扩展http://xace.javaeye.com/blog/579722

 

http://code.google.com/p/selenium/downloads/list下载selenium-server-standalone-2.0a2.jarselenium-server-standalone-2.0a2.jar

 

Webdriver是对selenium的一个封装,更加友好。Selenium2.0已经把webdriver合并进去。

 执行http://code.google.com/p/selenium/wiki/GettingStarted代码出错。

1       webdriver错误:

Exception in thread "main"org.openqa.selenium.WebDriverException: Cannot find firefox binary in PATH. Make sure firefox is installed.

 解决办法:指定firefox执行文件入系统属性。

    System.setProperty("webdriver.firefox.bin","D:/Program Files/Mozilla Firefox/firefox.exe");

       WebDriver driver =newFirefoxDriver();

       

2       解决selenium错误:

 

下载样例代码http://www.ibm.com/developerworks/cn/java/j-lo-selenium/

Selenium server需要在java1.5+环境下执行。

启动selenium server

java -jar selenium-server-standalone-2.0a2.jar。运行java selenium rc有错

 

java.lang.RuntimeException: Could not start Selenium session: Failed to start new browser session: java.lang.RuntimeException: Firefox 3 could not be found in the path!

Please add the directory containing ''firefox.exe'' to your PATH environment

variable, or explicitly specify a path to Firefox 3 like this:

*firefox3c:\blah\firefox.exe

 

 解决办法:指定firefox执行文件路径。

       selenium=newDefaultSelenium("localhost", 4444,"*firefox3 D:/Program Files/Mozilla Firefox/firefox.exe",

               "http://www.baidu.com");

 


TAG: Selenium selenium webdriver

慢慢悠悠的测试 引用 删除 fengzhulin   /   2012-05-24 14:00:04
你好,我用webdriver报错如下
[TestNG] Running:
  C:\Documents and Settings\yhd2\Local Settings\Temp\testng-eclipse--258347063\testng-customsuite.xml

com.thoughtworks.selenium.SeleniumException: Connection refused: connect
        at
求教解决办法,网络上搜罗了,都没有人 遇到
新哲的个人空间 引用 删除 新哲   /   2012-04-28 17:17:53
5
Mr.南柯 引用 删除 bob123654   /   2012-04-27 10:10:50
亲,淘宝也用selenium了吗?
serina03的个人空间 引用 删除 serina03   /   2012-04-24 17:09:32
知道webdriver怎么处理verify和assert么???
前端测试工程师@淘宝 引用 删除 Eric_Lee   /   2010-04-01 23:07:28
本来还想说学习Selenium目前最好的文档是官方文档,才发现被GFW了,汗
  http://seleniumhq.org/docs/

  还有就是个人觉得中文文档有个《Selenium私房菜》比《Selenium深入浅出》更好

  
 

评分:0

我来说两句

Open Toolbar