Class: TrueAutomation::Driver::Capybara

Inherits:
Capybara::Selenium::Driver
  • Object
show all
Defined in:
lib/true_automation/driver/capybara.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, **options) ⇒ Capybara

Returns a new instance of Capybara.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/true_automation/driver/capybara.rb', line 6

def initialize(app, **options)
  @port = options.delete(:port) || 9515

  super(app, options)

  @ta_client = TrueAutomation::Client.new

  @options.merge!(browser: :remote,
                  url: "http://localhost:#{@port}/",
                  desired_capabilities: {
                      browser: :chrome
                  })
end

Instance Method Details

#browserObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/true_automation/driver/capybara.rb', line 20

def browser
  unless @browser
    @ta_client.start(port: @port)

    @ta_client.wait_until_start

    at_exit do
      @ta_client.stop
    end

    super
  end
  @browser
end