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.
Instance Method Summary collapse
- #async_command(name, **params) ⇒ Object
- #async_commands(*names) ⇒ Object
- #command(name, **params) ⇒ Object
- #commands(*names) ⇒ Object
-
#initialize(browser, connection, session_id) ⇒ Session
constructor
A new instance of Session.
- #on(event_name, &block) ⇒ Object
Constructor Details
#initialize(browser, connection, session_id) ⇒ Session
Returns a new instance of Session.
8 9 10 11 12 13 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 8 def initialize(browser, connection, session_id) @browser = browser @connection = connection @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 |
Instance Method Details
#async_command(name, **params) ⇒ Object
24 25 26 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 24 def async_command(name, **params) send_cmd(name, **params).discard_result end |
#async_commands(*names) ⇒ Object
28 29 30 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 28 def async_commands(*names) names.map { |name| async_command(name) } end |
#command(name, **params) ⇒ Object
15 16 17 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 15 def command(name, **params) send_cmd(name, params).result end |
#commands(*names) ⇒ Object
19 20 21 22 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 19 def commands(*names) responses = names.map { |name| send_cmd(name) } responses.map(&:result) end |
#on(event_name, &block) ⇒ Object
32 33 34 |
# File 'lib/capybara/apparition/dev_tools_protocol/session.rb', line 32 def on(event_name, &block) connection.on(event_name, @session_id, &block) end |