Sie sind auf Seite 1von 3

NPM Version 6.12.

0
Node js Version 12.13.0
protractor Version 5.4.2
node js
protractor
tern plugin using eclipse
C:\Program Files\nodejs\
321.11124
C:\Program Files\nodejs

Config file contains : The configuration file lets you change things like which
browsers are used and how to connect to the Selenium Server.

exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js'],
capabilities: {
browserName: 'firefox'
}
}

Protractor Locators:

Binding: Finds the element based on the partial match of the attribute(Text)
Ex: element(by.binding('person.email'));
..........................................................................
exactBinding:
Selects the exact value of the attribute

<span ng-bind="person.email.id"></span> // this will not be found as it is not


exact value
<span ng-bind="person.email"></span> // this element will be found as it is exact
match
// usage of locator
element(by.binding('person.email'));
.........................................................................
Model locator:

Model locator checks whether any element has ng-model values matching with given
locator, if so that element will be returned

<span ng-model="person.name"></span>
// usage of locator
element(by.model('person.name'));
xPath : //input[@ng-model='Auth.user.name']
.......................................................................
ButtonText:

buttonText locator will try to match with an element which as same text as the
given locator, or its sub element inside the button tag

<button>Save</button>
// usage of locator
element(by.buttonText('Save'));
//HTML code
<button>
<label>Save As //matches
</label>
</button>

// usage of locator
element(by.buttonText('Save As'));
.........................................................................
partialButtonText

partialButtonText locator tries to find element with partial match present in the
button element's text

<button>Save As Text </button> //matches


// usage of locator
element(by.buttonText('Save'));
//HTML code
<button>
<label>Save As File //matches
</label>
</button>

// usage of locator
element(by.buttonText('Save As'));
.........................................................................
exactRepeater, Repeater:
.........................................................................
cssContainingText

cssContainingText locator tries to find elements by CSS which contain a certain


string

<ul>
<li class="pet">Dog</li> //matches
<li class="pet">Cat</li>
</ul>

// Returns the li for the dog, but not cat.


element(by.cssContainingText('.pet', 'Dog'))

protractor ./conf.js
.........................................................................

Login.spec.js

describe ("GS1 Canada Login", () =>


{
it ("should able to login", async () =>
{
const fiveThousand = 25000;
browser.waitForAngularEnabled (false);
browser.get ("https://www.google.com/webhp?
hl=en&sa=X&ved=0ahUKEwjkpvus8pfiAhVHFHIKHcPeAsAQPAgH", 30000);
browser.waitForAngularEnabled (true);
await browser.sleep (fiveThousand);
....................................................................
typeScript data types:

->number
->string
->boolean
->void
->undefined
->null

Ex:

var name:string = "John";


var score1:number = 50;
var score2:number = 42.50
.......................................................................
Object creation:

// create object for workbook


let wb:Workbook = new Workbook();

.......................................................................

typescript Version
3.8.0
.......................................................................

Project Structure:

|-- project-folder
|-- app
|-- css
|-- img
|-- partials
home.html
profile.html
contacts.html
|-- js
|-- controllers
|-- directives
|-- services
app.js
...
index.html
|-- test
|-- unit
|-- e2e
home-page.js
home-spec.js
profile-page.js
profile-spec.js
contacts-page.js
contacts-spec.js

Binding, Model Locators:

var nameElement = element(by.binding('color.name'));


var personName = element(by.model('person.name'));

Das könnte Ihnen auch gefallen