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

Johan Lindstrom
Johan Lindstrom
971 Points

need help with automation test

tried to follow the video , using Visual code editor and followed every single line but when I try to run it , and it will error. Must be something missing , node_modules?

Pls help me so I can keep up.

J

Craig Dennis
Craig Dennis
Treehouse Teacher

Can you paste the error please?

Johan Lindstrom
Johan Lindstrom
971 Points

This error is from my terminal.

Johans-MacBook-Pro:selenium-basics johanlindstrom$ ls
index.js    node_modules
Johans-MacBook-Pro:selenium-basics johanlindstrom$ http://port-80-l1qbbi2ceo.treehouse-app.com/ node index.js 
-bash: http://port-80-l1qbbi2ceo.treehouse-app.com/: No such file or director

If I use the Visual Studio Terminal. It's a different error. see below.

Johans-MacBook-Pro:selenium-basics johanlindstrom$ URL=http://port-80-l1qbbi2ceo.treehouse-app.com/ node index.js
/Users/johanlindstrom/Development/Treehouse/selenium-basics/node_modules/selenium-webdriver/lib/promise.js:2634
        throw error;
        ^

WebDriverError: unknown error: 'url' must be a string
Craig Dennis
Craig Dennis
Treehouse Teacher

On the terminal one you forgot to prefix it with URL=

Johan Lindstrom
Johan Lindstrom
971 Points

I changed this line.

//driver.get(process.env.url);

To driver.navigate().to("http://port-80-l1qbbi2ceo.treehouse-app.com/");

Opened up the page now :)

Craig Dennis
Craig Dennis
Treehouse Teacher

Ahh I see the other error Johan!

driver.get(process.env.url);

That URL is all uppercased when you set the environment variable, so you need to

driver.get(process.env.URL);
Johan Lindstrom
Johan Lindstrom
971 Points

Oh.. ? I'll try and keep u posted. Thx Craig

1 Answer

Craig Dennis Hi,

I am also facing the same issue. I am using windows system.

When I set the environment variable before running index.js, I get --> WebDriverError: unknown error: 'url' must be a string error when using VS code. But if i embed the URL in code just like Jonathan did above, it works.

Can you tell me how I can solve this problem.