Nicole Phillips Nicole Phillips - 4 months ago 33
AngularJS Question

Element not visible error

I am trying to click on an upload file link on my page however the upload link i said to be not visible. I've tried hovering over link and the code below. This has been easily fixed for me before so I'm really confused on how to go about getting this link clicked.
What I've tried:



var EC = protractor.ExpectedConditions;
var uploadLink = element(by.model('roomPlanCtrl.mm2010File'));

browser.wait(EC.elementToBeClickable(uploadLink), 10000);
uploadLink.click();





the HTML:



<span class="dg-link ng-untouched ng-valid ng-dirty ng-valid-parse" ngf-select="" ng-model="roomPlanCtrl.mm2010File" accept=".mms" ng-hide="roomPlanCtrl.hideImportLinks">Upload a MeetingMatrix 2010 File</span>




Answer

If your element is not visible, then you can probably try scrolling to that element and then click on it. If its visible on the page then wait until it loads and then click on it by chaining it to the wait() function. Here's a sample of that -

var EC = protractor.ExpectedConditions;
var uploadLink = element(by.model('roomPlanCtrl.mm2010File'));
browser.wait(EC.elementToBeClickable(uploadLink), 10000).then(function(){
    uploadLink.click();
});

Hope it helps.

Comments