M_ Fa
M_ Fa

Reputation: 497

"element not visible " cant get the element while user logged in protractor

I have weird problem with protractor.

In the page I can get element (its bonded to google address service) when user not logged I can get the element ,but if I sign up in my website and come back to same page, it say's element not visible.

Here is my element:

<input id="input" type="" ng-change="changedInputLocation()" class="form-control addressHr input_width_d ng-isolate-scope ng-pristine ng-valid" ng-attr-placeholder="{{bookingWidgetLanguage.txtWatermarkPickupAddress}}" name="addressHr" ng-autocomplete="" ng-model="addressHr" details="geoAddressHr" placeholder="PICKUP ADDRESS" autocomplete="off">

I used code below to grab the element:

element.all(by.css('[ng-model="addressHr"]')).sendKeys(' Wilshire Boulevard, Los Angeles, CA, United States', protractor.Key.ENTER);

Any advice is appreciated.

Upvotes: 0

Views: 853

Answers (1)

alecxe
alecxe

Reputation: 473833

We can only make guesses in this case, but here is an educated one: wait for the element to become visible before interacting with it:

var EC = protractor.ExpectedConditions;
var elm = element(by.model('addressHr'));

browser.wait(EC.visibilityOf(elm), 5000);

Also, note that I'm using element() instead of element.all() and by.model() locator.

Upvotes: 1

Related Questions