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 trialJason Ngo
6,947 PointsAnyone have a working source code?
For this video could someone provide their source code so I could compare?
2 Answers
robbertdekock
13,390 PointsI think that selenium doesn't like the amount of names in the array. When I reduce my array to 14 names, the code works just fine. When I put in all the names from the teacher notes, the code shows unexpected behavior. My final code looks as followed.
const selenium = require("selenium-webdriver");
const By = selenium.By;
const driver = new selenium.Builder()
.forBrowser("chrome")
.build();
driver.get(process.env.URL);
const invitees = [
'Gonzalo Fierro',
'Shadd Anderson',
'George Aparece',
'Shadab Khan',
'Taron Foxworth',
'David Riesz',
'Maicej Torbus',
'Martin Luckett',
'Joel Bardsley',
'Reuben Varzea',
'Ken Alger',
'Amrit Pandey',
'Rafal Rudzinski',
'Brian Lynch'
];
const locators = {
inviteeForm: By.id("registrar"),
inviteeNameField: By.css("#registrar input[name='name']"),
toggleNonRespondersVisibility: By.css(".main > div input")
}
function addInvitee(name) {
driver.findElement(locators.inviteeNameField)
.sendKeys(name);
driver.findElement(locators.inviteeForm).submit();
}
function toggleNonRespondersVisibility() {
driver.findElement(locators.toggleNonRespondersVisibility)
.click();
}
invitees.forEach(addInvitee);
toggleNonRespondersVisibility();
robbertdekock
13,390 PointsI see that after i run my code again it doesn't work anymore. Very strange how it randomly works. For mee it helped reducing the amount of names in the array.
barbarak
36,789 PointsIt's all working fine with the original names array for me.
Nikolay Latkin
5,211 PointsNikolay Latkin
5,211 PointsI believe that we all have the same issue with xpath. I don't think that code provided to us in tutorial going to work