Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
The structure of a page is called Page Objects, but the classes you create donβt need to be entire pages, they can be sub-pages as well. In this video we will show you how that works.
Learn More
No cheating
My subpage Object
class Invitee {
constructor(element) {
this.element = element;
this.locators = {
editButton: By.css('button:first-of-type'),
editNameField: By.css('input[type="text"]'),
removeButton: By.css('button:last-child'),
confirmedCheckbox: By.css('input[type="checkbox"]')
}
}
changeName(name) {
const button = this.element
.findElement(this.locators.editButton);
button.click();
const textField = this.element.findElement(this.locators.editNameField);
textField.clear();
textField.sendKeys(name);
button.click();
}
// ...
Usage
homePage
.findInviteeByName("Jennifer Nordell")
.changeName("Craig Dennis");
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up