zoukankan      html  css  js  c++  java
  • selenium RC例子

    1、先启动selenium server,命令:java -jar selenium-server-standalone-2.44.0.jar

    注:也可以把命令做成一个批处理文件,和selenium server放在同一级目录下,方便启动。

    2、eclipse里面用junit框架验证selenium脚本的运行结果,如下面的例子:

    package autotest;
    
    
    import static org.junit.Assert.*;
    
    import org.junit.After;
    import org.junit.Before;
    import org.junit.Test;
    
    import com.thoughtworks.selenium.DefaultSelenium;
    import com.thoughtworks.selenium.Selenium;
    
    
    
    
    @SuppressWarnings("deprecation")
    public class test12 {
        
        private Selenium selenium;
    
        
        @Before
            
        public void setUp() throws Exception {
                
        selenium = new DefaultSelenium("localhost", 4444, "*firefox  C:/program Files (x86)/Mozilla Firefox/firefox.exe", "http://win.emoney.cn/");
                
        selenium.start();
            
            
        }
    
            
        @Test
            
        public void test121() throws Exception {
                
        selenium.open("/");
                
        selenium.click("id=ds");
                
        selenium.waitForPageToLoad("30000");
                
        assertEquals("中国操盘手滚雪球炒股大赛正式开赛", selenium.getTitle());
            }
    
            
        @After
            
        public void tearDown() throws Exception {
    
                
        selenium.stop();
            
        }
    }

     这个java脚本是怎么获得的呢?是在selenium IDE中把selenium语言的脚本用Java/Junit/Remote Control格式导出,如下图:

  • 相关阅读:
    UVA11375
    uva11806(容斥原理)
    uva10325(容斥原理)
    hdu4135(容斥原理)
    CF798
    多线程
    (转载)SVN 提交操作缩写(A D M R) .
    上不了网,如何判断
    (转载)myeclipse项目名称重命名
    mysql模糊查询
  • 原文地址:https://www.cnblogs.com/bobo1104/p/4157733.html
Copyright © 2011-2022 走看看