Class: Webdriver::Session
- Inherits:
-
Object
- Object
- Webdriver::Session
- Defined in:
- lib/webdriver/session.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #back! ⇒ Object
- #delete! ⇒ Object
- #execute_sync!(script, args = []) ⇒ Object
- #forward! ⇒ Object
-
#initialize(json, connection) ⇒ Session
constructor
A new instance of Session.
- #refresh! ⇒ Object
- #screenshot ⇒ Object
- #title ⇒ Object
- #url ⇒ Object
- #url!(url) ⇒ Object
- #windows ⇒ Object
Constructor Details
#initialize(json, connection) ⇒ Session
Returns a new instance of Session.
5 6 7 8 |
# File 'lib/webdriver/session.rb', line 5 def initialize(json, connection) @id = json.dig "id" @connection = Webdriver::PrefixConnection.new "session/#{@id}", connection end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/webdriver/session.rb', line 3 def id @id end |
Instance Method Details
#back! ⇒ Object
29 30 31 |
# File 'lib/webdriver/session.rb', line 29 def back! @connection.post "back" end |
#delete! ⇒ Object
10 11 12 |
# File 'lib/webdriver/session.rb', line 10 def delete! @connection.delete end |
#execute_sync!(script, args = []) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/webdriver/session.rb', line 45 def execute_sync! script, args=[] @connection.post "execute/sync", {}, { script: script, args: args } end |
#forward! ⇒ Object
33 34 35 |
# File 'lib/webdriver/session.rb', line 33 def forward! @connection.post "forward" end |
#refresh! ⇒ Object
37 38 39 |
# File 'lib/webdriver/session.rb', line 37 def refresh! @connection.post "refresh" end |
#screenshot ⇒ Object
52 53 54 |
# File 'lib/webdriver/session.rb', line 52 def screenshot @connection.get "screenshot" end |
#title ⇒ Object
41 42 43 |
# File 'lib/webdriver/session.rb', line 41 def title @connection.get "title" end |
#url ⇒ Object
25 26 27 |
# File 'lib/webdriver/session.rb', line 25 def url @connection.get "url" end |
#url!(url) ⇒ Object
19 20 21 22 23 |
# File 'lib/webdriver/session.rb', line 19 def url! url @connection.post "url", {}, { url: url } end |