Giter Club home page Giter Club logo

webdriver-manager-replacement's Introduction

webdriver-manager CircleCI

Use as a dependency

To install this as a dependency: npm install -D webdriver-manager. The following is an example running webdriver-manager as a dependency. The test downloads the providers and starts the selenium server standalone as detached. After the test, it will shutdown the selenium server standalone.

import {
  Options,
  setLogLevel,
  shutdown,
  start,
  update,
} from 'webdriver-manager';

const options: Options = {
  browserDrivers: [{
    name: 'chromedriver'     // For browser drivers, we just need to use a valid
                             // browser driver name. Other possible values
                             // include 'geckodriver' and 'iedriver'.
  }],
  server: {
    name: 'selenium',
    runAsNode: true,          // If we want to run as a node. By default
                              // running as detached will set this to true.
    runAsDetach: true         // To run this in detached. This returns the
                              // process back to the parent process.
  }
};
setLogLevel('info');          // Required if we webdriver-manager to log to
                              // console. Not setting this will hide the logs.

describe('some web test', () => {
  beforeAll(async () => {
    await update(options);
    await start(options);
  });

  it('should run some web test', async () => {
    // Your async / await web test with some framework.
  });

  afterAll(async () => {
    await shutdown(options);  // Makes the web request to shutdown the server.
                              // If we do not call shutdown, the java command
                              // will still be running the server on port 4444.
  });
});

Use as a command line interface

npm i -g webdriver-manager

webdriver-manager update      // Downloads the latest binaries.
webdriver-manager start       // Starts the selenium server standalone.

Notes:

  • Installing globally will not work with Protractor if you are trying to start a Selenium Standalone server with a "local" or "directConnect", because Protractor installs its own version of webdriver-manager as a dependency.
  • Right now there is an issue with downloading the latest ChromeDriver. It might not be compatible with the current version of Chrome. The latest available version of ChromeDriver is the v74.x.x.x but this one only works with Chrome v74.x.x.x which is in Beta right now. So, if you have installed the latest stable version of Chrome (v73.x.x.x) you should pin that ChromeDriver version to be downloaded: webdriver-manager update --versions.chrome=73.0.3683.68. To find out the latest version, check out http://chromedriver.chromium.org/ .

The command line interface help commands

To get a list of commands for webdriver-manager, use the help flag.

webdriver-manager --help
webdriver-manager [command]

Commands:
  webdriver-manager clean     Removes downloaded files from the out_dir.
  webdriver-manager shutdown  Shutdown a local selenium server with GET request
  webdriver-manager start     Start up the selenium server.
  webdriver-manager status    List the current available binaries.
  webdriver-manager update    Install or update selected binaries.

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]

To get a list of options that can be passed to the webdriver-manager update command, use the help flag.

webdriver-manager update --help
webdriver-manager update

Install or update selected binaries.

Options:
  --version              Show version number                           [boolean]
  --help                 Show help                                     [boolean]
  --out_dir              Location of output.                            [string]
  --chrome               Install or update chromedriver.
                                                       [boolean] [default: true]
  --gecko                Install or update geckodriver.[boolean] [default: true]
  --github_token         Use a GitHub token to prevent rate limit issues.
                                                                        [string]
  --iedriver             Install or update ie driver. [boolean] [default: false]
  --ignore_ssl           Ignore SSL certificates.                      [boolean]
  --log_level            The log level of this CLI.   [string] [default: "info"]
  --proxy                Use a proxy server to download files.          [string]
  --standalone           Install or update selenium server standalone.
                                                       [boolean] [default: true]
  --versions.chrome      The chromedriver version.                      [string]
  --versions.gecko       The geckodriver version.                       [string]
  --versions.ie          The ie driver version.                         [string]
  --versions.standalone  The selenium server standalone version.        [string]

webdriver-manager-replacement's People

Contributors

cnishina avatar abhijeethp avatar zachauten avatar

Stargazers

Artem Vasilev avatar  avatar Jithin Mathew avatar Sigurd Fosseng avatar winfredchen avatar Boris Osipov avatar Christian Bromann avatar Ram Pasala avatar ethan avatar

Watchers

James Cloos avatar  avatar

webdriver-manager-replacement's Issues

Add types/@yargs back.

What a long long discussion about string literals, debugging, type definitions, etc etc. I know how to get it not to complain. Still not a big fan of it but YOLO.

proxy integration tests

Create a test suite for just proxy.

Files for tests: *.spec-proxy.ts and a spec/jasmine-proxy.json

Proxy server: spec/proxy/

find an open port when given a port range

this option is only done via this as a dep and should not be done via the cli.

so maybe the selenium server provider config:

{
  // port is okay if we know its going to be open
  portRangeStart: 4000,
  portRangeEnd: 5000,
  ...
}

Go through (starting at port 4000) and try to get a port that is open.

Wrong chromedriver version

I noticed today that when using the webdriver-manager update command it downloads the Chromedriver v74.x.x and it only runs with the Chrome v74, which I don't have on my machine yet because the latest Chrome stable version is v73.

At chromedriver site, it says that Chromedriver v74.x.x is in beta too.

Why this started to download and apply chromedriver beta versions?

bug unhandled rejection error with chrome

webdriver-manager-replacement update --gecko=false --out_dir=downloads --versions.chrome=71.0.3578.80
/Users/craignishina/src/protractor-lite/node_modules/webdriver-manager-replacement/downloads
curl -o /Users/craignishina/src/protractor-lite/downloads/selenium-server-standalone-3.141.59.jar https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
(node:83818) UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at getVersionObj (/Users/craignishina/src/protractor-lite/node_modules/webdriver-manager-replacement/dist/lib/provider/utils/version_list.js:49:31)
    at Object.getVersion (/Users/craignishina/src/protractor-lite/node_modules/webdriver-manager-replacement/dist/lib/provider/utils/version_list.js:13:12)
    at ChromeDriver.updateBinary (/Users/craignishina/src/protractor-lite/node_modules/webdriver-manager-replacement/dist/lib/provider/chromedriver.js:62:43)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:697:11)
    at startup (internal/bootstrap/node.js:201:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)
(node:83818) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:83818) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Avoid using symbolic links for binaries

On windows tried to launch git-web-launcher and the error message is as follows:

D:\src\git-web-launcher\lib>web chrome_launch.ts
curl -o D:\Users\cnishina\AppData\Roaming\nvm\v8.11.3\node_modules\git-web-launcher\downloads\chromedriver.xml https://chromedriver.storage.googleapis.com/
curl -o D:\Users\cnishina\AppData\Roaming\nvm\v8.11.3\node_modules\git-web-launcher\downloads\chromedriver_win32.zip https://chromedriver.storage.googleapis.com/2.40/chromedriver_win32.zip
unlink: D:\Users\cnishina\AppData\Roaming\nvm\v8.11.3\node_modules\git-web-launcher\downloads\chromedriver.exe
add symbolic link: D:\Users\cnishina\AppData\Roaming\nvm\v8.11.3\node_modules\git-web-launcher\downloads\chromedriver.exe
for: D:\Users\cnishina\AppData\Roaming\nvm\v8.11.3\node_modules\git-web-launcher\downloads\chromedriver_2.40.exe
Error: The specified executable path does not exist: D:\Users\cnishina\AppData\Roaming\nvm\v8.11.3\node_modules\git-web-launcher\downloads\chromedriver
    at new DriverService.Builder (D:\Users\cnishina\AppData\Roaming\nvm\v8.11.3\node_modules\git-web-launcher\node_modules\selenium-webdriver\remote\index.js:319:13)
    at new ServiceBuilder (D:\Users\cnishina\AppData\Roaming\nvm\v8.11.3\node_modules\git-web-launcher\node_modules\selenium-webdriver\chrome.js:239:5)
    at Object.<anonymous> (D:\Users\cnishina\AppData\Roaming\nvm\v8.11.3\node_modules\git-web-launcher\dist\chrome_launch.js:55:27)
    at Generator.next (<anonymous>)
    at fulfilled (D:\Users\cnishina\AppData\Roaming\nvm\v8.11.3\node_modules\git-web-launcher\dist\chrome_launch.js:4:58)
    at <anonymous>

The error message looks like symbolic links do not work. Maybe we keep track of the binary locations in a file.

When stopping server....

When stopping the server, keep track if we started it as a role = node. If so, stop server could use the API to kill it. If not, we could use the pid.

initOptions

Instead of doing this:

    // if value is not set, nothing from wdm gets logged.
    log.setLevel('info');

    // Should create an initOptions method instead of this...
    chrome = new wdm.ChromeDriver({});
    selenium = new wdm.SeleniumServer({});
    const options = {
      providers: [{
        binary: chrome
      }],
      server: {
        binary: selenium,
        runAsNode: true,
        runAsDetach: true
      }
    };
    return wdm.update(options).then(() => {
      return wdm.start(options);
    });

Create a initOptions method to create options.

fix flaky cloud_storage_xml test

cloud_storage_xml with a http server updateXml should request and write the file if it is expired

Sample error:

Failures:
1) cloud_storage_xml with a http server updateXml should request and write the file if it is expired
  Message:
    Expected 510 to be greater than 510.
  Stack:
    Error: Expected 510 to be greater than 510.
        at <Jasmine>
        at UserContext.it (/home/circleci/workspace/dist/lib/provider/utils/cloud_storage_xml.spec-int.js:106:26)
        at <Jasmine>
        at process._tickCallback (internal/process/next_tick.js:189:7)

appium installation

  • create an appium directory
  • create an appium/package.json file
  • add dependency for appium with appium script

Isolate the logging level only for webdriver-manager

Using loglevel in other projects: setting loglevel to "info" for protractor-pull-a-part also sets the webdriver-manager loglevel to info. Setting the webdriver-manager.setLogLevel should only control webdriver-manager.

improve logging

with logging preferences to either log to file or via logging flag

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.