Class: Capybara::Apparition::DevToolsProtocol::Session
- Inherits:
-
Object
- Object
- Capybara::Apparition::DevToolsProtocol::Session
- Defined in:
- lib/capybara/apparition/dev_tools_protocol/session.rb
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
-
#target_id ⇒ Object
readonly
Returns the value of attribute target_id.
Instance Method Summary collapse
- #async_command(name, **params) ⇒ Object
- #async_commands(*names) ⇒ Object
- #command(name, **params) ⇒ Object
- #commands(*names) ⇒ Object
-
#initialize(browser, connection, target_id, session_id) ⇒ Session
constructor
A new instance of Session.
- #on(event_name, &block) ⇒ Object
Constructor Details
#initialize(browser, connection, target_id, session_id) ⇒ Session
Returns a new instance of Session.
8 9 10 11 12 13 14 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 8 def initialize(browser, connection, target_id, session_id) @browser = browser @connection = connection @target_id = target_id @session_id = session_id @handlers = [] end |
Instance Attribute Details
#browser ⇒ Object (readonly)
Returns the value of attribute browser.
6 7 8 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 6 def browser @browser end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
6 7 8 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 6 def connection @connection end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
6 7 8 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 6 def session_id @session_id end |
#target_id ⇒ Object (readonly)
Returns the value of attribute target_id.
6 7 8 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 6 def target_id @target_id end |
Instance Method Details
#async_command(name, **params) ⇒ Object
25 26 27 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 25 def async_command(name, **params) send_cmd(name, params).discard_result end |
#async_commands(*names) ⇒ Object
29 30 31 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 29 def async_commands(*names) names.map { |name| async_command(name) } end |
#command(name, **params) ⇒ Object
16 17 18 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 16 def command(name, **params) send_cmd(name, params).result end |
#commands(*names) ⇒ Object
20 21 22 23 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 20 def commands(*names) responses = names.map { |name| send_cmd(name) } responses.map(&:result) end |
#on(event_name, &block) ⇒ Object
33 34 35 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 33 def on(event_name, &block) connection.on(event_name, @session_id, &block) end |