Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Element not visible error [duplicate]

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>
like image 334
Nicole Phillips Avatar asked Nov 19 '25 14:11

Nicole Phillips


1 Answers

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.

like image 79
giri-sh Avatar answered Nov 22 '25 04:11

giri-sh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!