Hello! I can not find on the move. If I want to connect chrome, I will download the chromedriver package and do:

require('chromedriver'); this.driver = new webdriver.Builder() .forBrowser('chrome') .build(); 

And what kind of driver can I get from npm and connect to phantomjs? I do not want to keep the driver in the project. I want to take them from npm.

    1 answer 1

    For the next generation ... In the source webdriver found a solution ...

    We take the necessary packages

     npm i phantomjs-prebuilt chromedriver selenium-webdriver --save 

    Phantom code:

     let phantomjs = webdriver.Capabilities.phantomjs(); phantomjs.set("phantomjs.binary.path", require('phantomjs-prebuilt').path); let driver = new webdriver.Builder() .withCapabilities(phantomjs) .build(); 

    Code for chrome

     let chrome = require('selenium-webdriver/chrome'); chrome.setDefaultService(new chrome.ServiceBuilder(require('chromedriver').path).build()) let driver = new webdriver.Builder() .forBrowser('chrome') .build();