SeleniumHQ / selenium-ide

Open Source record and playback test automation for the web.
https://selenium.dev/selenium-ide/
Apache License 2.0
2.81k stars 765 forks source link

ReferenceError: webdriver is not defined #731

Open vishal-lehar opened 5 years ago

vishal-lehar commented 5 years ago

🐛 Bug Report

I just recently upgraded to selenium-side-runner version 3.9.0. When I run it against my side files, I receive this error: ReferenceError: webdriver is not defined.

To Reproduce

image

Steps to reproduce the behavior:

uf@uf-VB:~/test/tms-qa$ selenium-side-runner Test.side -c browserName=chrome chromeOptions.args=[disable-infobars, headless] info: Running Test.side FAIL ./DefaultSuite.test.js ● Test suite failed to run

ReferenceError: webdriver is not defined

  1 | jest.setMock('selenium-webdriver', webdriver);
> 2 | // This file was generated using Selenium IDE
    | ^
  3 | const tests = require(./commons.js);
  4 | global.Key = require('selenium-webdriver').Key;
  5 | global.URL = require('url').URL;

  at Object.<anonymous> (DefaultSuite.test.js:2:1)

Test Suites: 1 failed, 1 total Tests: 0 total Snapshots: 0 total Time: 1.219s Ran all test suites.

Expected behavior

Project file reproducing this issue (highly encouraged)

Please provide a project file .side that reproduces this issue.

Issues without a reproduction project are likely to stall.

Environment

OS: Linux uf-VB 4.15.0-51-generic #55-Ubuntu Selenium IDE Version: 3.10 Selenium SIDE Runner Version: 3.9.0 Please note that selenium-side-runner supports Node.js 8 - 10 --> Node version: 8 Only required if using selenium-side-runner --> Browser: Chrome Browser Version: Version 75.0.3770.100 (Official Build) (64-bit)

tourdedave commented 5 years ago

I'll need to see the contents of what was generated during the run.

NODE_ENV=development selenium-side-runner -e /path/to/side/file

This will create a folder prefixed with side- (e.g., side-Test) in the current working directory. Please zip that up and attach it to this issue.

tourdedave commented 5 years ago

Related to #701

vishal-lehar commented 5 years ago

Getting below error for setting NODE_ENV :-


uf@uf-VB:~/test/tms-qa$ NODE_ENV=development selenium-side-runner -e /home/uf/test/tms-qa/
warn:    This feature is used by Selenium IDE maintainers for debugging purposes, we hope you know what you're doing!
fs.js:115
    throw err;
    ^

Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:491:3)
    at tryReadSync (fs.js:330:20)
    at Object.readFileSync (fs.js:367:19)
    at projects.map.p (/usr/local/lib/node_modules/selenium-side-runner/dist/index.js:363:42)
    at Array.map (<anonymous>)
    at Object.<anonymous> (/usr/local/lib/node_modules/selenium-side-runner/dist/index.js:362:16)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
tourdedave commented 5 years ago

You need to provide the full path to the project file, including the filename and its extension.

e.g. NODE_ENV=development selenium-side-runner -e /home/uf/test/tms-qa/Test.side

vishal-lehar commented 5 years ago

Ahh..my bad.. Thanks for the exact command... here is zip file... 731.zip

tourdedave commented 5 years ago

What version of Node are you running? (e.g., node -v)

vishal-lehar commented 5 years ago

uf@uf-VB:~/test/tms-qa$ node -v v10.14.0

tourdedave commented 5 years ago

I have a hunch of what the problem is, but I need more info from your machine.

I need you to run the suite using the extracted directory. To do that, you can use the -r flag (instead of -e) and specify the path to the extracted directory (instead of the SIDE project file).

E.g., NODE_ENV=development selenium-side-runner -r /home/uf/test/tms-qa/side-Test

After it runs, zip the directory again and attach it here.

vishal-lehar commented 5 years ago

Getting below error while running with option -r with extracted diretcory:-


uf@uf-VB:~/test/tms-qa$ NODE_ENV=development selenium-side-runner -r /home/uf/test/tms-qa/side-suite-all-tms-1/
warn:    This feature is used by Selenium IDE maintainers for debugging purposes, we hope you know what you're doing!
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: spawn /usr/local/bin/node ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
    at onErrorNT (internal/child_process.js:407:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
    at onErrorNT (internal/child_process.js:407:16)
    [... lines matching original stack trace ...]
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
uf@uf-VB:~/test/tms-qa$
vishal-lehar commented 5 years ago

Getting same error while running with -r option:- image

vishal-lehar commented 5 years ago

731-1.zip

Zesko commented 3 years ago

Have the same issue on Manjaro KDE.

There is geckodriver in my OS.

/usr/bin/geckodriver
/usr/lib/node_modules/geckodriver
/usr/lib/node_modules/geckodriver/bin/geckodriver
/usr/lib/node_modules/geckodriver/geckodriver

How to set parameter of selenium-ride-runner to load webdriver?

chromedriver has the same issue.

Thank you!