Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Quality Assurance

I just cant get Selenium to wait for new page to load however I try.

I'm trying to have each individual URLs locators and functions in its own javascript object and then call the functions from one index.js file. The sight i'm trying to perform tests on has a login and as soon as selenium has logged in and functions from the next pages object are called selenium runs into an error where the elements for that page cannot be found.

require('chromedriver');
const selenium = require("selenium-webdriver");
const By = selenium.By;
const until = selenium.until;


const LoginPage = require('./pages/login');
const NewList = require('./pages/newlist');

const driver = new selenium.Builder().forBrowser("chrome").build();

const loginPage = new LoginPage(driver);
loginPage.open();
loginPage.login();

// This is where i get errors
// How do I get selenium to pause here until the new page is loaded

const newList = new NewList(driver);
newList.clickButton();