0
<select class="edit-doc-select" ng-model="vm.currentDoc.class.Id">
<option ng-repeat="class in vm.types" value="1" ng-selected="false">
Unclass </option>
<option ng-repeat ="class in vm.types" value="2" ng-selected="true">
class </option>
</select>

This this html code for drop down list on web application page. I want to select drop down list first, then one of the value - unclass OR class However, inspect element of drop down list control gives 'select' element For that I am using element(by.model("vm.currentDoc.class.Id")).

It throws element not visible error

elvin
  • 961
  • 1
  • 9
  • 26
Sandeep Lohar
  • 39
  • 1
  • 3
  • What is actually the question? Why element on page is invisible for protractor and visible for user? It is better to ask frontend devs that created such page – Xotabu4 Apr 24 '16 at 13:12
  • @Sandeep [see this answer](http://stackoverflow.com/questions/19599450/how-to-select-option-in-drop-down-protractorjs-e2e-tests?lq=1) and also [this post](https://technpol.wordpress.com/2013/12/01/protractor-and-dropdowns-validation/) – Gunderson Apr 24 '16 at 16:25
  • @Xotabu4 If it's visible to the user then it's visible to Protractor – Gunderson Apr 24 '16 at 16:27

2 Answers2

1

Clicking on a menu should be 2-step operation:

  • Click on the top to open the menu
  • Click on the menu option

Take a look at the protractor test I wrote for the protractor website:

var menu = require('./menu-partial');

it('should go to tutorial', function() {
  menu.dropdown('Quick Start').item('Tutorial');

  expect($('h1').getText()).toBe('Tutorial');
});

Page object: https://github.com/angular/protractor/blob/master/website/test/e2e/menu-partial.js

Andres D
  • 8,910
  • 2
  • 26
  • 31
0

Use Debugger weather the element is present or not Use "browser.enterRepl()" program will be in debugging mode, now try to find weather the element isDisplayed, element(by.id('xyz')).isDisplayed(); Try to write it in promise so that it will wait until the promise is complete. Use some Expected Condition element to clickableExpected Condition

Nick
  • 484
  • 5
  • 18
  • I have tried all the solutions suggested but no luck :( . I am trying to trouble shoot it by accessing simple controls e.g. text box, buttons using element (by.buttonText('Text on button') etc. and observed same error of element not visible. However, all these locators are accessible using their xpath seamlessly. :) . Now this work around serves my purpose for now. But question remains same - what restricts protractor to access angular elements (model, buttonText, css) on same page. – Sandeep Lohar May 02 '16 at 08:28
  • can look weather is it inside any frame? – Nick May 02 '16 at 19:16
  • No its not inside any frame. – Sandeep Lohar May 08 '16 at 10:48