欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

protractor的安裝與基本使用教程

 更新時間:2017年07月07日 09:26:03   作者:菠蘿君  
這篇文章主要給大家介紹了關(guān)于protractor安裝與基本使用的相關(guān)資料,文中介紹的非常詳細(xì),對大家具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起看看吧。

前言

Protractor是一個建立在WebDriverJS基礎(chǔ)上的端到端(E2E)的AngularJS JavaScript Web應(yīng)用程序測試框架。Protractor全自動化真實的模擬用戶在真正的瀏覽器中操作、運(yùn)行并測試開發(fā)者的應(yīng)用程序。下面就來一起看看關(guān)于protractor安裝與基本使用的相關(guān)內(nèi)容吧。

1、JDK的安裝和環(huán)境的配置

     關(guān)于JDK的安裝配置這里就不說了,需要的朋友們可以參考這篇文章

2、npm protractor

npm install -g protractor 

3、npm install protractor的依賴項

基于第二步下載到的文件,在命令行里面進(jìn)入到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> 

總結(jié)

以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,如果有疑問大家可以留言交流,謝謝大家對腳本之家的支持。

您可能感興趣的文章:

相關(guān)文章

最新評論