`
yangzb
  • 浏览: 3470822 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

selenium 和webdriver_入门实践

    博客分类:
  • QC
阅读更多

  我们一直非常强调建立以底层为核心的分层自动化测试 体系,虽然 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.iteye.com/blog/579722

 

http://code.google.com/p/selenium/downloads/list 下载 selenium-server-standalone-2.0a2.jar selenium-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 = new FirefoxDriver();

       

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 = new DefaultSelenium( "localhost" , 4444, "*firefox3 D:/Program Files/Mozilla Firefox/firefox.exe" ,

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

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics