Page object:
class Product {
get button() { return (".element"); }
}
module.exports = new Product();
Code
var pageObject = require('../pageObjects/product.page.js');
describe("Test", function () {
before( function () {
browser.url();
pageObject.button.click();
});
This returns an error when the test is ran of
pageObject.button.click is not a function
I have other page objects being utilized in the test outside of the before hook that are working fine. When I move the above object outside of the hook and into the main test, it still returns the same error. It appears to be setup the same as my other page objects, so I'm not sure what I am doing wrong.
Based on what i can see from you Product
class, the getter button()
is not returning the webElement. It is returning just a string .element
.
Please try by updating the code as like below:
class Product {
get button() { return $(".element"); }
}
module.exports = new Product();
Thanks, Naveen