Reputation: 539
I am using protractor and selenium server with angularJS for UI testing,
This is my TestCase:
it('Click on Top Headings one by one', function () {
//click on Top Heading one by one
ptor.element.all(by.repeater('application in workbenchOptions.applications')).then(function (arrs) {
ptor.sleep(3000);
arrs[2].click();
ptor.sleep(3000);
arrs[3].click();
ptor.sleep(3000);
arrs[1].click();
ptor.sleep(3000);
arrs[2].click();
ptor.sleep(3000);
arrs[0].click();
ptor.sleep(2000);
});
});
This is my UI where I am trying to click each heading one by one
First of all I am clicking on arrs[2]
i.e. Clientside Test Case
then I am clicking on arrs[3]
, arrs[1]
, arrs[2]
, arrs[0]
, everything is clicking , but if in the beginning suppose arrs[0]
is already open then I am not able to click on this again and I got a error message
UnknownError: unknown error: Element is not clickable at point (1254, 21).
Other element would receive the click:
<div class="slider-wrapper pl-pageslide-wrapper" style="transition: width 0.3s, height; -webkit-transition: width 0.3s, height; z-index: 1000; position: fixed; left: 0px; top: 0px; bottom: 0px; right: 0px; width: auto; background: rgba(0, 0, 0, 0.498039);">...</div>
I tested against both Chrome and Firefox and the same error occurs
Upvotes: 1
Views: 3460
Reputation: 1141
I had a similar problem with elements without a fixed position. I used the following code in protractor:
var el = ...; // some protractor element
el.getLocation().then(function(location) {
browser.executeScript("window.scrollTo(0," + (location.y - 70)+ ")");
el.click();
});
Note: I also use an offset of -70px because the page has a menu fixed at the top of the page. Without the offset, elements get scrolled behind the menu and the message "Element is not clickable..." is displayed again.
Upvotes: 2
Reputation: 511
i think is this helpful to you:
ptor.executeScript('window.scrollTo(1254,21);').then(function() {
element(by.<<here your button locator>>).click();
})
your webdriver is unable to read that point (1254,21),the reason is your protractor browser unable to cover the full of page what do you want to test, then we give a command that browser is scroll to that point (1254,21), then perform the click operation
Upvotes: 1