zoukankan      html  css  js  c++  java
  • protractor安装和基本使用

    1 jdk 的安装和环境的配置,自行百度

    2 npm protractor

    npm install -g protractor
    

    3 npm install protractor的依赖项

    基于第二步下载到的文件,在命令行里面进入到nodejs ->protractor的目录

    npm install
    

    4 test工程

    包括一个简单的angular的页面,一个配置文件和一个测试文件

    配置文件protractor_conf.js代码:

    /**
     * Created by Administrator on 2015/4/24.
     */
    exports.config = {
        directConnect: true,
    
        // Capabilities to be passed to the webdriver instance.
        capabilities: {
            'browserName': 'chrome'
        },
    
        // Spec patterns are relative to the current working directly when
        // protractor is called.
        specs: ['test.js'],
    
        // Options to be passed to Jasmine-node.
        jasmineNodeOpts: {
            showColors: true,
            defaultTimeoutInterval: 30000
        }
    };
    

    test.js文件代码

    /**
     * Created by Administrator on 2015/4/24.
     */
    describe('angularjs homepage', function () {
        it('should greet the named user', function () {
            browser.get('http://localhost:63342/protractor/Index.html');
            element(by.id('userName')).sendKeys(' Sparrow');
            browser.sleep(4000);
        });
    });
    

    Index.html的代码

    <!DOCTYPE html>
    <html data-ng-app="protractor">
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
    <div data-ng-controller="myAppController">
        {{userName}}
        <input id="userName" data-ng-model="userName" />
    </div>
    </body>
    <script src="lib/angular.min.js"></script>
    <script>
        var app = angular.module('protractor',[]);
        app.controller('myAppController',['$scope',function($scope){
            $scope.userName = 'Jackey';
        }]);
    </script>
    
    </html>
    

     

  • 相关阅读:
    关于SQL
    win10商店或者账户连不上网
    pom.xml红叉
    3D球状标签云(兼容IE8)
    网页宽高自适应大小
    html5定位并在百度地图上显示
    【转】Javascript 中的false,零值,null,undefined和空字符串对象
    jQuery checkBox 全选的例子
    jQuery 表单验证 jquery.validator.js
    jQuery 手风琴侧边菜单
  • 原文地址:https://www.cnblogs.com/lihaozhou/p/4455466.html
Copyright © 2011-2022 走看看