How to calculate the choice of options in the transporter?

I want to count the parameters in the select attribute, but my test failed, here is my specification:

it('should count the number of option', function()) { expect(element(by.id('sorting_options')).all(by.tagName('option').count())).toBe(3); } 

he gives me an error:

C: \ wamp \ www \ First- angular -App> protractor conf.js Initial selenium stand-alone server ... [launcher] Starting 1 instance of WebDriver The stand-alone Selenium server started from http://192.168.100.9:12708/wd/hub [ launcher] Error: C: \ wamp \ www \ First- angular -App \ protractorSpec \ spec.js: 37 it ('should count the number of options', function ()) {^

+4
source share
2 answers

Your code is garbled, here is the correct syntax:

 it('should count the number of option', function () { expect(element(by.id('sorting_options')).all(by.tagName('option')).count()).toBe(3); }); 
+4
source

Alternatively, use the abstraction / wrapper around the selected input here :

 var SelectWrapper = require('select-wrapper'); var sorting = new SelectWrapper(by.id('sorting_options')); expect(sorting.getOptions().count()).toEqual(3); 
0
source

All Articles