Class: Capybara::Apparition::DevToolsProtocol::Target
- Inherits:
-
Object
- Object
- Capybara::Apparition::DevToolsProtocol::Target
- Defined in:
- lib/capybara/apparition/dev_tools_protocol/target.rb
Instance Attribute Summary collapse
-
#info ⇒ Object
Returns the value of attribute info.
Instance Method Summary collapse
- #close ⇒ Object
- #id ⇒ Object
-
#initialize(browser, info) ⇒ Target
constructor
A new instance of Target.
- #page ⇒ Object
- #title ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(browser, info) ⇒ Target
Returns a new instance of Target.
10 11 12 13 14 |
# File 'lib/capybara/apparition/dev_tools_protocol/target.rb', line 10 def initialize(browser, info) @browser = browser @info = info @page = nil end |
Instance Attribute Details
#info ⇒ Object
Returns the value of attribute info.
8 9 10 |
# File 'lib/capybara/apparition/dev_tools_protocol/target.rb', line 8 def info @info end |
Instance Method Details
#close ⇒ Object
40 41 42 |
# File 'lib/capybara/apparition/dev_tools_protocol/target.rb', line 40 def close @browser.command('Target.closeTarget', targetId: id) end |
#id ⇒ Object
16 17 18 |
# File 'lib/capybara/apparition/dev_tools_protocol/target.rb', line 16 def id info['targetId'] end |
#page ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/capybara/apparition/dev_tools_protocol/target.rb', line 28 def page @page ||= begin if info['type'] == 'page' Page.create(@browser, create_session, id, ignore_https_errors: @browser.ignore_https_errors, js_errors: @browser.js_errors).inherit(info.delete('inherit')) else nil end end end |
#title ⇒ Object
20 21 22 |
# File 'lib/capybara/apparition/dev_tools_protocol/target.rb', line 20 def title info['title'] end |
#url ⇒ Object
24 25 26 |
# File 'lib/capybara/apparition/dev_tools_protocol/target.rb', line 24 def url info['url'] end |