Alichino Alichino - 3 months ago 17x
AngularJS Question

Unable to locate element (text-field) in Angular JS using selenium in Python

I'm having a problem sending keys to a text field on an webpage written in angular JS.

Here is the WebElement in question:

<input name="CreateUserForename" id="Textc3829619-ad42-4df7-bbe3-5bdbe9fb9bce"
ng-class="{'ng-pristine': controller.$pristine, 'ng-invalid': controller.$invalid,
'ng-invalid-required': controller.$error.required, 'ng-valid': controller.$valid,
'ng-dirty': controller.$dirty}" class="form-input ng-scope ng-valid ng-dirty" type="text"
ng-if="!multiline" ng-hide="disabled" maxlength="">

Just using
gives this error:

Message: no such element: Unable to locate element:

Same when using the css_selector.

One workaround I've found is using ActionChains and
, but that is not ideal.

Any ideas?

(please don't suggest the Protractor)


OK, it seems that driver.find_element_by_name("CreateUserForename") does the trick.