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 Introduction to Selenium Automation Nation Page Object Model

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Selenium runs tests then automatically closes the browser

Hi all,

Here's a problem.

I've got my finished code which successfully runs the tests, but then promptly closes the browser. I don't think it's a problem with code, maybe I need to update Selenium Web Driver?

[0926/152756.483:ERROR:process_reader_win.cc(123)] NtOpenThread: {Access Denied} A process has requested access to an object, but has not been granted those access rights.  (0xc0000022)
[0926/152756.552:ERROR:exception_snapshot_win.cc(87)] thread ID 7616 not found in process
[0926/152756.552:WARNING:crash_report_exception_handler.cc(62)] ProcessSnapshotWin::Initialize failed
//import seleniun package
const selenium = require("selenium-webdriver");

//require browser driver for google Chrome

//use Selenium By Library
const By = selenium.By;

const HomePage = require("./pages/home");

//build pattern to access webpage.
const driver = new selenium.Builder()

const homePage = new HomePage(driver);

//array of invitees
const invitees = [
    'Gonzalo Torres del Fierro',
    'Shadd Anderson',
    'George Aparece',
    'Shadab Khan',
    'Joseph Michael Casey',
    'Jennifer Nordell',
    'Faisal Albinali',
    'Taron Foxworth',
    'David Riesz',
    'Maicej Torbus',
    'Martin Luckett',
    'Joel Bardsley',
    'Reuben Varzea',
    'Ken Alger',
    'Amrit Pandey',
    'Rafal Rudzinski',
    'Brian Lynch',
    'Lupe Camacho',
    'Luke Fiji',
    'Sean Christensen',
    'Philip Graf',
    'Mike Norman',
    'Michael Hulet',
    'Brent Suggs'

//perform actions
//addInvitee("first name");
//addInvitee("last name");

//invitees.forEach(invitee => homePage.addInvitee(invitee));
invitees.forEach(homePage.addInvitee, homePage); 

//call the functions

homePage.removeInvitee("Shadd Anderson");

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

class HomePage {

    constructor(driver) {
        //store reference to the driver in instance
        this.driver = driver;
        //JavaScript Object Literal
        this.locators = {
            inviteeForm: By.id("registrar"),
            inviteeNameField: By.name("name"),
            toggleNonRespondersVisibility: By.css(".main > div input"),
            removeButtonForInvitee: invitee => By.xpath(`//span[text() = "${invitee}"]/../button[last()]`)



    open() {
        //open URL

    //keep it DRY with functions
    addInvitee(name) {


    removeInvitee(invitee) {

    toggleNonRespondersVisibility() {

module.exports = HomePage;
Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

I did just test this on my laptop, having done a git pull on the project.

The test seems to have run properly and not crashed the browser. I've verified also that it did not add anything new to the npm.debug file.

I must have done something to the configuration on my PC that changed something but I can't think what. I know you're not all mind readers but any thoughts? Help :)??

Craig Dennis

1 Answer

Have you installed with protractor? I have seen the similar error message posted on https://stackoverflow.com/questions/40246655/chrome-automation-extension-error-using-selenium-with-protractor-jasmine

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hi Linda, I’m sorry I seemed to have missed this answer. But I’ll make a point To try it out, I don’t think the course used it but it can’t hurt to try :)