"Database Foundations" was retired on March 22, 2017. You are now viewing the recommended replacement.

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

visual studio not inputting URL into browser after driver.get(URL) because 'URL must be a string'

I have input the code, following along the video, and i'm up to the point of 6:45 where the teacher types in "set URL=port..... node index.js" and when I do the same I get an new open chrome browser (which is good) but the URL isn't set and the error I get is listed below. While playing around to get this to work, I don't get the "URL must be a string" error but I do get a "[Error] Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:51539". I am permanently stuck, please send help!

"WebDriverError: unknown error: 'url' must be a string"

This is the code that i'm using:

require('chromedriver'); 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("Kevin Yu"); addInvitee("Joe Schmo");

This is the error:

[ERROR] node : C:\users\kevin.yu\selenium-basics\node_modules\selenium-webdriver\lib\promise.js:2626 [ERROR] AT line:1 char:1 [ERROR] + node index.js [ERROR] + ~~~~~~~~~~~ [ERROR] +Category Info :Not Specified: (C:\users\kevin...promise.js:2626:String) [], RemoteException [ERROR] + FullyQualifiedErrorId: Native Command Error [ERROR] [ERROR] throw error; [ERROR] ^ [ERROR] [ERROR] WebdriverError: uknown error: 'url' must be a string [ERROR] (Session info: chrome=68.0.3440.106 [ERROR] (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6v3704b), platform=Windows NT 10.0.17134 x64_64) [ERROR] at Object.checkLegacyResponse (C:\Users\kevin.yu\selenium-basics\node_modules\selenium-webdriver\lib\error.js:546:15) [ERROR] at parseHttpResponse (C:\users\kevin.yu...…) [ERROR] doSend.then.response (C:\users\kevin.yu.....) [ERROR] at process.)_tickCallback (internal/process/next_tick.js:68:7) [ERROR] From: Task: WebDriver.navigate().to(undefined)

3 Answers

putting in the Terminal Output: Set URL=port-80-6p76k7hj7t.treehouse-app.com node index.js --- gives me a "A positional parameter cannot be found that accepts argument 'index.js' error

Working code: const selenium = require("selenium-webdriver");

const By = selenium.By;

const chrome = require("chromedriver");

const URL = "https://port-80-dl2wbpmuap.treehouse-app.com/";

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

driver.get(URL);

I think the courses should be updated regularly.

Hello, unfortunately this method is not working still,

  • driver.get(URL);
  • ~~~
    • CategoryInfo : ObjectNotFound: (URL:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

thats the error

Format is bad, so I can email anyone this issue in a better format if that helps, thanks in advance.