1

Inputting the code below in Visual Studio, typing "node index.js" into the Terminal Output gives me:

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

-have tried just using driver.get(URL); and typing into the Terminal Output "Set URL=http://port-80-6p76k7hj7t.treehouse-app.com/ node index.js" which returns an error message of "A positional parameter cannot be found that accepts argument 'index.js'"

-have tried \ and // for the URL

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("https://port-80-6p76k7hj7t.treehouse-app.com/");
const locators = { inviteeForm: By.id("registrar"), inviteeNameField: By.name("name") };
function addInvitee(name) { driver.findElement(locators.inviteeNameField).sendKeys(name); driver.findElement(locators.inviteeForm).sub(); }

add invitee("Kevin Smith");
add invitee("Joe Smith");

Error i'm getting is:

[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]     + CategoryInfo          : NotSpecified: (C:\users\kevin....promise.js:2626:String) [], RemoteException
[ERROR]     + FullyQualifiedErrorId : NativeCommandError
[ERROR]  
[ERROR]         throw error;
[ERROR]         ^
[ERROR] 
[ERROR] WebDriverError: unknown error: 'url' must be a string
[ERROR]   (Session info: chrome=68.0.3440.106)
[ERROR]   (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 10.0.17134 x86_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\selenium-basics\node_modules\selenium-webdriver\lib\http.js:509:13)
[ERROR]     at doSend.then.response (C:\users\kevin.yu\selenium-basics\node_modules\selenium-webdriver\lib\http.js:441:30)
[ERROR]     at process._tickCallback (internal/process/next_tick.js:68:7)
[ERROR] From: Task: WebDriver.navigate().to(undefined)
[ERROR]     at thenableWebDriverProxy.schedule (C:\users\kevin.yu\selenium-basics\node_modules\selenium-webdriver\lib\webdriver.js:807:17)
[ERROR]     at Navigation.to (C:\users\kevin.yu\selenium-basics\node_modules\selenium-webdriver\lib\webdriver.js:1133:25)
[ERROR]     at thenableWebDriverProxy.get (C:\users\kevin.yu\selenium-basics\node_modules\selenium-webdriver\lib\webdriver.js:988:28)
[ERROR]     at Object.<anonymous> (C:\users\kevin.yu\selenium-basics\node_modules\index.js:12:8)
[ERROR]     at Module._compile (internal/modules/cjs/loader.js:689:30)
[ERROR]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
[ERROR]     at Module.load (internal/modules/cjs/loader.js:599:32)
[ERROR]     at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
[ERROR]     at Function.Module._load (internal/modules/cjs/loader.js:530:3)
[ERROR]     at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
[ERROR] 

I am permanently stuck, please send help! Thanks in advance!

4
  • 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'
    – Kevin yu
    Aug 30, 2018 at 18:10
  • I don't see in your code where URL is defined from driver.get(URL);. Are you missing some code or is that the issue?
    – JeffC
    Aug 30, 2018 at 18:20
  • I tried defining the URL through multiple options such as const URL = "port...." or driver.get("port...") and in the original post I put the URL in the terminal output as set URL = port.... node index.js
    – Kevin yu
    Aug 30, 2018 at 18:25
  • OK. Edit your question and post a complete minimal reproducible example and the resulting error for that code. Right now it looks like you didn't define URL which would cause the issue you are referring to.
    – JeffC
    Aug 30, 2018 at 18:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.