Search code examples
angularjsprotractorend-to-end

Proptractor error when call element methods


All my actions, it is just:

element(by.binding('item.order.id')).click();

On this code area:

<tr
  ng-repeat="item in dataList.content"
  ng-class="{'colored-order': (settingsStorage.getProperty('personal', 'coloredOrders') === true || settingsStorage.getProperty('personal', 'coloredOrders') === 'true')}"
  class="{{item.order.status}}"
>
  <td>
    <a
      href="{{contextPath}}/company/view/{{item.ownerId}}/"
      target="_blank"
    >
      <strong
        class="mL20"
        ng-if="search.viewType === 'ARRIVED'"
        ng-cloak
      >
        {{item.order.billTo.name}}
      </strong>
    </a>
    <strong
      class="mL20"
      ng-if="search.viewType !== 'ARRIVED'"
      ng-cloak
    >
      {{item.order.billTo.name}}
    </strong>
  </td>
  <td>
    <a
      ui-sref="vieworder({ orderId: item.order.id })"
      class="link_to_view_order"
      analytics-event
      analytics-category-attr="Order_View"
    >
      {{item.order.id}}
    </a>
  </td>
</tr>

Message:
    Failed: Timed out waiting for asynchronous Angular tasks to finish after 11 seconds. This may be because the current page is not an Angular application. Please see the FAQ for more details: https://github.com/angular/protractor/blob/master/docs/timeouts.md#waiting-for-angular
    While waiting for element with locator - Locator: by.binding("item.order.id").
    The following tasks were pending:
     - $timeout: function () {
          delete $rootScope.pagesCache.pages[data.page];
          if ($state.current.name == data.page) {
            $rootScope.$broadcast('update:data:' + data.page, { page: data.page });
          }
        }

But when i had try print to console this element, it was printed, without problems.


Solution

  • Could be the same issue as answered in the question - Protractor Locator Time Out exception for AngularJs application

    Normally root cause for these issues would be when site continuously polls $timeout or $http, Protractor will wait indefinitely and time out.

    More details on why you could see this error is documented here.I have explained the below aletrnatives in detail in the other answer at

    1. IgnoreSynchronization: Check here

    2. Interval.js :

    3. Try with different timeOut configurations and see if your app polling stops after some time

    allScriptsTimeout: 120000, getPageTimeout: 120000, jasmineNodeOpts: { defaultTimeoutInterval: 120000 }