Driver8 (driver8 v0.1.0-dev) View Source

Module that provides everything you need to build a Webdriver extension. This is not a wrapper for your Selenium tests, but a basis for Remote end. Similar to what Appium does for Mobile testing, you can create your own extension and use it via standard W3C Webdriver wire protocol.

If you want to give it a try right away, run mix new demo to create a new mix application called demo. Switch to your demo folder cd demo. Change your mix.exs to look like this (project section should already look like this, you simply need to adjust application and deps sections):

defmodule Demo.MixProject do
use Mix.Project
    def project do
      [
        app: :demo,
        version: "0.1.0",
        elixir: "~> 1.10",
        start_permanent: Mix.env() == :prod,
        deps: deps()
      ]
    end

    def application do
      [
        extra_applications: [:logger, :cowboy, :plug, :jason, :eex],
        mod: {Demo, []},
        env: [
          port: 8085
        ]
      ]
    end

    defp deps do
      [
        {:httpoison, "~> 1.6"},
        {:plug_cowboy, "~> 2.0"},
        {:driver8, "~> 0.1-dev"}
      ]
    end
end

Now update your main module Demo (found in lib/demo.ex) to look like this:

defmodule Demo do
    use Application

    def start(_type, _args) do
      children = [
        Plug.Adapters.Cowboy.child_spec(
          scheme: :http,
          plug: Driver8.Plug,
          options: [ port: 8085 ]
        ), Driver8 ]

      Supervisor.start_link(children, [strategy: :one_for_one, name: Demo.Supervisor])
    end
end

After that you need to get dependencies by running mix deps.get. Now you can start application by running iex -S mix. If all goes according to plan then after you open your browser and point it at (http://localhost:8085/) you should see a greeting message similar to this: You are using Driver 8 (elixir) 0.1.0. Congrats, you are running you very own webdriver extension (which does exactly nothing, but still, pretty cool!).

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.