Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Quality Assurance Introduction to Selenium Automation Nation Getting Started

Nikita Novikov
Nikita Novikov
5,929 Points

Not recognized as the name of a cmdlet, function, script file or operable program.

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

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

driver.get(URL); const locators = { inviteeForm: By.id("registrar") inviteeNameField: By.name("name") };

function addInvitee(name) { driver.findElement(locators.inviteeNameField) .sendKeys(name); driver.findElement(locators.inviteeForm).submit(); }

addInvitee("Bla Bla"); addInvitee("Bla Bla Bla");

Error: PS C:\Users\novik\selenium-basics> URL=http://port-80-8x1ng7gsjy.treehouse-app.com/ node index.js URL=http://port-80-8x1ng7gsjy.treehouse-app.com/ : The term 'URL=http://port-80-8x1ng7gsjy.treehouse-app.com/' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

Julian Shadrin
Julian Shadrin
15,495 Points

const selenium = require('selenium-webdriver'); const chrome = require('selenium-webdriver/chrome'); const chromedriver = require('chromedriver');

const By = selenium.By;

chrome.setDefaultService(new chrome.ServiceBuilder(chromedriver.path).build()); const driver = new selenium.Builder().forBrowser('chrome').build(); const url = 'https://port-80TEST/';

driver.get(url);

const locators = { inviteeForm: By.id('registrar'), inviteeNameField: By.name('name') };

const addInvitee = (name) => { driver.findElement(locators.inviteeNameField).sendKeys(name); driver.findElement(locators.inviteeForm).submit(); };

addInvitee('Julian'); addInvitee('Mohamed'); addInvitee('Chris');

=====> type "node index.js" or whatever your script file is into the terminal. Only downside is pressing ctrl + c twice, to clear terminal after each time you run the script and not influencing the script dynamically through REPL.