samedi 19 mai 2018

How to get Text of an option present in

<select class="form-control m-b slctrLevel"
[(ngModel)] = "level.id"
name = "LevelId" >
    <optgroup class="slctrLevelLabel" label = "Levels" >
        <option value = "" * ngFor="let levelInfo of levelInfo" >
    
    </option>
< /optgroup>
< /select>

Protractor Test Code

 let levelPoint = 100;
 let levels = element.all(by.className("slctrLevel")).first();
 levels.getText().then(value => {
 console.log("Gamification Level :" + value);
 expect(levelPoint).toBe(value);

 });

ScreenShot of UI

When I try to get Text from select tag . It gives whole options Text. Technically selected Value Text should be returned. Due to which Expected Condition gets Failed.

 - Expected '100' to be ' 100
                          200
                          300
                          400

Aucun commentaire:

Enregistrer un commentaire