0

Screenshot added for the element locator

I have tried below ways but didn't work out.

 element(by.css('option', 'APPLE')).click();
 element(by.xpath("//select[contains(@ng-reflect-model,'Apple')]")).click();

1 Answers1

0

There are several approach can select the option:

1)
element(by.cssContainingText('select[formcontrolname="brandName"] > option', 'APPLE')).click();

2)  
element(by.css('select[formcontrolname="brandName"] > option[ng-reflect-value="APPLE"]')).click();

3)
element(by.xpath('//select[@formcontrolname="brandName"]/option[text()="APPLE"]')).click();
yong
  • 13,357
  • 1
  • 16
  • 27
  • Tried as above but displaying error Message as: **Message: Failed:No element found using locator: By(css selector, select[formcontrolname="brandName"] > option[ng-reflect-value="APPLE"])** **Message: Failed: No element found using locator: By(xpath, //select[@formcontrolname="brandName"]/option[text()="APPLE"]) ** **Message: Failed: element(by.cssContainingText('select[formcontrolname="brandName"] > option', 'APPLE')).click()** – user2981742 Oct 15 '18 at 08:18