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 Intermediate Selenium WebDriver Use Selenium with Testing Frameworks Selenium and Mocha

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 Points

Selenium is running test just in Safari as opposed to Chrome and Firefox

at 4:55 I have the same code as the video:

const { Browser, By, Key, until } = require('selenium-webdriver');
const { suite } = require("selenium-webdriver/testing");
const assert = require('assert');


suite(function(env) {
  describe('RSVP site', function() {
    it('has invitee', function() {
      assert(1 == 1);
    })
  })
});

But when I run the code it only runs it in Safari, not in Chrome and Firefox as in the video.

[safari]
    RSVP site
      ✓ has invitee


  1 passing (5ms)

Why is that?

1 Answer

Jay McGavren
STAFF
Jay McGavren
Treehouse Teacher

Do you have the drivers for those browsers installed? Once you do, they'll be run automatically.

npm install -g chromedriver
npm install -g geckodriver
Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 Points

Ah. I ran those commands but didn't realize that they had failed with permission denied. Not sure what to do about it, this is using sudo:

Downloading https://chromedriver.storage.googleapis.com/2.40/chromedriver_mac64.zip
Saving to /tmp/chromedriver/chromedriver_mac64.zip
Received 781K...
Received 1568K...
Received 2352K...
Received 3136K...
Received 3920K...
Received 4704K...
Received 5488K...
Received 5532K total.
Extracting zip contents
Copying to target path /usr/local/lib/node_modules/chromedriver/lib/chromedriver
ChromeDriver installation failed { Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/chromedriver/lib/chromedriver'
    at Object.fs.mkdirSync (fs.js:902:18)
    at /usr/local/lib/node_modules/chromedriver/install.js:230:10
    at <anonymous>
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/usr/local/lib/node_modules/chromedriver/lib/chromedriver' }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! chromedriver@2.40.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the chromedriver@2.40.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/brendanwhiting/.npm/_logs/2018-07-18T16_39_31_541Z-debug.log
Jay McGavren
Jay McGavren
Treehouse Teacher

Googling for "npm install g Error: EACCES: permission denied" returned this page; looks like it might be helpful. https://docs.npmjs.com/getting-started/fixing-npm-permissions Let us know what results you get!

Brendan Whiting
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 Points

Sorry it took me so long to respond. I went through the suggestion "Manually change npm’s default directory" at the link and it worked. Although when I run the tests, it still runs with just Safari, not sure why. At any rate, I was able to complete the course without issues.

Thanks.