zoukankan      html  css  js  c++  java
  • web项目的集成测试:模拟点击

    利用模拟点击的方式进行集成测试,我们准备用google,Firefox和ie三种浏览器测试.

    其中除了Firefox是模拟点击的鼻祖不需要插件外,谷歌和ie需要另外下载插件

      chromedriver.exe;

      IEDriverServer.exe

    chrome测试:

         File file = new File("C:/Selenium/chromeDriver.exe");
            System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
            driver = new ChromeDriver();
         baseUrl = "http://www.cnblogs.com/";
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
            driver.get(baseUrl + "/garfieldcgf/");
            driver.findElement(
                    By.id("homepage1_HomePageDays_DaysList_ctl00_DayList_TitleUrl_0"))
                    .click();

    ie测试:

         DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
            caps.setCapability(
                    InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
                    true);
            File file = new File("C:/Selenium/IEDriverServer.exe");
            System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
            driver = new InternetExplorerDriver();
         baseUrl = "http://www.cnblogs.com/";
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
            driver.get(baseUrl + "/garfieldcgf/");
            driver.findElement(
                    By.id("homepage1_HomePageDays_DaysList_ctl00_DayList_TitleUrl_0"))
                    .click();

    Firefox测试:

         driver = new FirefoxDriver();
         baseUrl = "http://www.cnblogs.com/";
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
            driver.get(baseUrl + "/garfieldcgf/");
            driver.findElement(
                    By.id("homepage1_HomePageDays_DaysList_ctl00_DayList_TitleUrl_0"))
                    .click();
  • 相关阅读:
    React Native 触摸事件处理详解
    ReactNative iOS源码解析
    windows CMD命令大全及详细解释和语法
    Node.js的全局对象和全局变量
    移动端HTML5<video>视频播放优化实践
    HTML和CSS代码片段快速编写方式(Emmet Documentation)
    animate.css官网
    Gradle在大型Java项目上的应用
    Gradle学习系列
    Gradle -- buildScript块与allprojects块及根级别的repositories区别
  • 原文地址:https://www.cnblogs.com/garfieldcgf/p/5647195.html
Copyright © 2011-2022 走看看