I am trying to write a protractor test to check that a page's footer is at the bottom of the page.
I've looked at sources like these to help me:
How to get an element's top position relative to the browser's viewport? https://plainjs.com/javascript/styles/get-the-position-of-an-element-relative-to-the-document-24/
I want to use the getBoundingClientRect function discussed in these sources to get the footer's position, but I am getting an error saying: footer.getBoundingClientRect is not a function
Here is the relevant portion of my code:
footer = element(by.css('lib-footer > mat-toolbar'));
const viewportOffset = footer.getBoundingClientRect();
const bottom = viewportOffset.bottom;
browser.driver.manage().window().getSize().then((size) => {
expect(bottom).toBeGreaterThan(size.height - 50);
});
I know that the footer element is defined because I have already run other tests on it to check things like its color and size.
Why am I being told that getBoundingClientRect is not a function?