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 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,727 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.