YggY
YggY

Reputation: 59

RobotFramework: can'f find element with JavaScript

Working with RF in recent weeks I noticed a problem, which stuck me for a long time. I have constant error:

Element with locator 'XXX' (this is a template, of course) not found

Investigation of span that wanted to locate revealed, that it has some JavaScript code under it, that, from what I think, enables it dynamically.

input bo-attr="" id="inventory-keyword" ng-attr-placeholder="{{('inventoryMode.' + {true: 'KEYWORD_DEVICE_PLACEHOLDER', false: 'KEYWORD_TEMPLATE_PLACEHOLDER'}[items.currentSeen == VIEWS.EQUIPEMENT]) | translate}}" ng-model="getCurrentFilters().searchString" class="ng-pristine ng-valid" placeholder="Name, description..."

How to have it passed by RobotFramework? Or maybe source of the problem is different?

There are other elements like this (with sth that appaers to be JavaScript under it), and none of it is seen by RF, except the main menu.

Upvotes: 0

Views: 418

Answers (1)

Dinesh Pundkar
Dinesh Pundkar

Reputation: 4196

From the Javascript code you have added to post, it seems the underlying Web Application uses AngularJS (I can see ng-model in code).

Sometimes, you cannot identify elements in AngularJS developed Webpage using the default ways the Selenium provides.

You can use AngularJS library or ExtendedSelenium2Library which has new ways to locate elements like model/binding etc.

Check below links for more information :

Upvotes: 0

Related Questions