{"id":26453288,"url":"https://github.com/elixir-wallaby/web_driver_client","last_synced_at":"2025-10-27T19:45:55.125Z","repository":{"id":40351919,"uuid":"214509790","full_name":"elixir-wallaby/web_driver_client","owner":"elixir-wallaby","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-06T13:03:26.000Z","size":509,"stargazers_count":14,"open_issues_count":9,"forks_count":13,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-04T14:03:33.611Z","etag":null,"topics":["chromedriver","elixir","hacktoberfest","selenium","testing","webdriver"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elixir-wallaby.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-10-11T18:59:38.000Z","updated_at":"2024-09-09T20:29:27.000Z","dependencies_parsed_at":"2023-07-13T11:18:39.956Z","dependency_job_id":null,"html_url":"https://github.com/elixir-wallaby/web_driver_client","commit_stats":null,"previous_names":["aaronrenner/web_driver_client"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/elixir-wallaby/web_driver_client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-wallaby%2Fweb_driver_client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-wallaby%2Fweb_driver_client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-wallaby%2Fweb_driver_client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-wallaby%2Fweb_driver_client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elixir-wallaby","download_url":"https://codeload.github.com/elixir-wallaby/web_driver_client/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-wallaby%2Fweb_driver_client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266161900,"owners_count":23885927,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chromedriver","elixir","hacktoberfest","selenium","testing","webdriver"],"created_at":"2025-03-18T18:57:40.698Z","updated_at":"2025-10-27T19:45:55.030Z","avatar_url":"https://github.com/elixir-wallaby.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebDriverClient\n[![codecov](https://codecov.io/gh/aaronrenner/web_driver_client/branch/master/graph/badge.svg)](https://codecov.io/gh/aaronrenner/web_driver_client)\n\nA low-level [WebDriver] client for Elixir. This library is still a work in progress.\n\n## Overview\n\nWebDriverClient is designed to be a low-level library that allows projects to call WebDriver\nREST APIs while abstracting away the differences between the [JWP] and [W3C] protocols. This\nlibrary is designed to be the API client for higher-level libraries, like [Wallaby] or [Hound].\n\n```elixir\n{:ok, session} =\n  \"http://localhost:9515\"\n  |\u003e WebDriverClient.Config.build(protocol: :w3c)\n  |\u003e WebDriverClient.start_session(%{\"capabilities\" =\u003e %{}})\n\n\n:ok = WebDriverClient.navigate_to(session, \"http://dockyard.com\")\n\n{:ok, element} = WebDriverClient.find_element(session, :css_selector, \".site-nav__logo__link\")\n\nWebDriverClient.fetch_element_text(session, element) # =\u003e {:ok, \"DockYard Home\"}\n\n:ok = WebDriverClient.end_session(session)\n```\n\n### Design considerations\n* Should be a thin, well-documented API client that calls the WebDriver REST APIs.\n* Should provide a main API that abstracts away the differences between the JWP and W3C\n  protocols.\n* (Future) Should provide protocol-specific APIs as an escape-hatch to access functionality\n  that is not common to both protocols.\n* Sometimes the user will request one protocol and the server returns the other protocol. This\n  happens if the user sends the incorrect payload on session start, or requests an\n  endpoint that is not tied to an individual session (like listing sessions).\n\n  This library should gracefully handle these situations, while still notifying the user\n  that the wrong protocol was returned.\n\n### What this library is not\n* This is not a high-level library to be used for day to day\n  testing. Features like retries, pipeline commands, etc\n  are outside the scope of this project. These features are better\n  delegated to a high-level library like [Wallaby] or [Hound].\n\n\n\n## Testing\n\nIn order to ensure the reliability of this library, test coverage is very\nimportant. This comes through the following types of tests.\n\n### Unit test\n\nThe unit test suite can be run with the following command.\n\n```\nmix test\n```\n\n### Integration tests\n\nAlthough each webdriver implementation should be the same in theory, it's good to double-check that this library actually works. The following webdriver implementations are supported via the test suite:\n\n* `chromedriver`\n* `phantomjs`\n* `selenium_2`\n* `selenium_3`\n\nNote: This project does not start any WebDriver program. Those need to be started separately.\n\n#### ChromeDriver\n\nTo install ChromeDriver on OS X:\n\n```\n$ brew cask install chromedriver\n```\n\nBefore running test suite, start up chromedriver\n\n```\n$ chromedriver\n```\n\nThen to run the integration tests, run:\n\n```\n$ mix test --only integration_test_driver:chromedriver\n```\n\n#### PhantomJS\n\nTo install PhantomJS on OS X:\n\n```\n$ brew cask install phantomjs\n```\n\nBefore running test suite, start up phantomjs\n\n```\n$ phantomjs --wd\n```\n\nThen to run the integration tests, run:\n\n```\n$ mix test --only integration_test_driver:phantomjs\n```\n\n#### Selenium\n\nTo install ChromeDriver on OS x:\n\n```\n$ brew install selenium-server-standalone\n```\n\nYou also need to install the webdriver servers\n\nFor firefox:\n```\n$ brew install geckodriver\n```\n\nFor chrome:\n```\n$ brew install chromedriver\n```\n\nBefore running test suite, start up selenium\n\n```\n$ selenium-server\n```\n\nThen to run the integration tests, run:\n\n```\n$ mix test --only integration_test_driver:selenium_3\n```\n\nIf you'd like to run only the selenium tests for chrome, run:\n\n```\n$ mix test --only integration_test_driver_browser:selenium_3-chrome\n```\n\nAnd to only run selenium tests for firefox, run:\n\n```\n$ mix test --only integration_test_driver_browser:selenium_3-firefox\n```\n\n##### Selenium 2\nIf you'd like to run integration tests for `selenium_2`, just replace `selenium_3` with\n`selenium_2`.\n\n```\n$ mix test --only integration_test_driver:selenium_2\n```\n\n#### Running on remote webdriver servers\n\nSometimes it's nice to be able to run against a remote webdriver server.\nHere's an example that runs the tests against a docker container.\n\n1. Start the docker container for the webdriver server\n\n    ```\n    $ docker run -p 4446:4444 --shm-size=2g selenium/standalone-chrome:3\n    ```\n\n2. Run the tests\n\n    ```\n    $ SELENIUM_3_BASE_URL=\"http://localhost:4446/wd/hub\" TEST_SERVER_HOSTAME=\"host.docker.internal\" mix test --only integration_test_driver_browser:selenium_3-chrome\n    ```\n\n    The environment variables work like this:\n\n    * `\u003cDRIVER_NAME\u003e_BASE_URL` - The base url for the webdriver server to run\n       against. Can also use `WEBDRIVER_BASE_URL` to set this across all scenarios.\n    * ` TEST_SERVER_HOSTNAME` - The hostname the webdriver server should use to access\n      the machine that's running the test suite.\n\n        The test suite starts up a test HTTP server, but when using a remote webdriver\n        server, the webdriver server needs to where the test pages live. When running in\n        docker for Mac, the hostname of the host computer is `host.docker.internal`.\n\n\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `web_driver_client` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:web_driver_client, \"~\u003e 0.2.0\"}\n  ]\nend\n```\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/web_driver_client](https://hexdocs.pm/web_driver_client).\n\n## Documentation\n\nDocumentation can be built locally with the following command.\n\n```sh\n$ mix docs\n```\n\nTo view documentation for pre-release APIs, docs can be built\nwith:\n\n```sh\n$ MIX_ENV=docs_prerelease mix docs\n```\n\nIt's important to note the pre-release APIs aren't public and\nmay change at any time.\n\n[WebDriver]: https://w3c.github.io/webdriver/\n[JWP]: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol\n[W3C]: https://w3c.github.io/webdriver/\n[Wallaby]: https://github.com/elixir-wallaby/wallaby\n[Hound]: https://github.com/HashNuke/hound\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-wallaby%2Fweb_driver_client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felixir-wallaby%2Fweb_driver_client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-wallaby%2Fweb_driver_client/lists"}