Junaid Khan Junaid Khan - 4 days ago 5
AngularJS Question

cannnot focus element in dropdown test

This is my dropdown in angular

<div class="form-group">
<label>Select Entity:</label>
<select class="form-control" id="sel1">
<option value="Select">Select</option>
<option value="Test">Test</option>
</select>
</div>


protractor test case is this:

var entity = element(by.id('sel1')).click();
var option = element(by.tagName('option[value="Test"]')).click();


i am getting error in protractor :


Failed: unknown error: cannot focus element

Answer
var entity = element(by.id('sel1')).click();
var option = element(by.cssContainingText('option', 'Test')).click();  
Comments