sitespeedio / edgedriver

MIT License
0 stars 3 forks source link

Add edgedriver to PATH automatically #1

Open StephanBijzitter opened 4 years ago

StephanBijzitter commented 4 years ago

The equivalent chromedriver and geckodriver packages also do this, and make setting up selenium just a bit simpler, where requiring the package is enough to set it all up.

For example: https://github.com/giggio/node-chromedriver/blob/master/lib/chromedriver.js#L18

If you want, I could create a pull request for this.

StephanBijzitter commented 4 years ago

Well, I tried to do this. Added to the PATH just fine, that's easy... but Selenium did not like it very much. The browser opens, but then everything just crashes. No idea how this happens, but it seems that (at least for nodejs selenium), PATH isn't very useful (yet).

I might just be doing something wrong, though.

soulgalore commented 4 years ago

@StephanBijzitter are you sure you have the correct version of the driver? When I tried some time ago it was really confusing, some old drivers worked with newer Edge, and some didn't.

StephanBijzitter commented 4 years ago

@soulgalore

Versions:

Argument - This works, no issues at all:

const driverBinary = require('@sitespeed.io/edgedriver').binPath();

const service = new Edge.ServiceBuilder(driverBinary).build();
const driver = Edge.Driver.createSession(capabilities, service);

PATH - This is able to open the browser, but then crashes:

const driverBinary = require('@sitespeed.io/edgedriver').binPath();
process.env.PATH = driverBinary + path.delimiter + process.env.PATH;

const service = new Edge.ServiceBuilder().build();
const driver = Edge.Driver.createSession(capabilities, service);
WebDriverError: Unknown error
    at parseHttpResponse (C:\Users\Steph\Documents\GitHub\Dullahan\packages\dullahan-adapter-selenium-4\node_modules\selenium-webdriver\lib\http.js:582:11)
    at Executor.execute (C:\Users\Steph\Documents\GitHub\Dullahan\packages\dullahan-adapter-selenium-4\node_modules\selenium-webdriver\lib\http.js:491:26)

And just for a sanity check, this complains that it cannot find a suitable driver, as expected:

const service = new Edge.ServiceBuilder().build();
const driver = Edge.Driver.createSession(capabilities, service);

After updating to Edge 83.0.478.37, the first example fails (version mismatch), but strangely enough the second example has the exact same behavior: Unknown error.

Edit: After also updating the driver, first example works again (as expected), second example still fails in the same way. Edit2: Changing the PATH entry to the directory (rather than the executable) does not make a difference