[フレーム]

Class: Selenium::WebDriver::Remote::Capabilities

Inherits:
Object
  • Object
  • Selenium::WebDriver::Remote::Capabilities
show all
Defined in:
lib/selenium/webdriver/remote/capabilities.rb

Overview

Specification of the desired and/or actual capabilities of the browser that the server is being asked to create.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Capabilities

Returns a new instance of Capabilities.

Parameters:

  • :browser_name (Hash)

    a customizable set of options

  • :version (Hash)

    a customizable set of options

  • :platform (Hash)

    a customizable set of options

  • :javascript_enabled (Hash)

    a customizable set of options

82
83
84
85
86
87
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 82
def initialize(opts = {})
 @browser_name = opts[:browser_name] || ""
 @version = opts[:version] || ""
 @platform = opts[:platform] || :any
 @javascript_enabled = opts[:javascript_enabled] || false
end

Instance Attribute Details

#browser_nameObject

Returns the value of attribute browser_name.

11
12
13
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 11
def browser_name
 @browser_name
end

#javascript_enabledObject Also known as: javascript?

Returns the value of attribute javascript_enabled.

11
12
13
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 11
def javascript_enabled
 @javascript_enabled
end

#platformObject

Returns the value of attribute platform.

11
12
13
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 11
def platform
 @platform
end

#versionObject

Returns the value of attribute version.

11
12
13
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 11
def version
 @version
end

Class Method Details

.chrome(opts = {}) ⇒ Object

53
54
55
56
57
58
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 53
def chrome(opts = {})
 new({
 :browser_name => "chrome",
 :javascript_enabled => true
 }.merge(opts))
end

.firefox(opts = {}) ⇒ Object

19
20
21
22
23
24
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 19
def firefox(opts = {})
 new({
 :browser_name => "firefox",
 :javascript_enabled => true
 }.merge(opts))
end

.htmlunit(opts = {}) ⇒ Object

33
34
35
36
37
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 33
def htmlunit(opts = {})
 new({
 :browser_name => "htmlunit"
 }.merge(opts))
end

.internet_explorer(opts = {}) ⇒ Object

26
27
28
29
30
31
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 26
def internet_explorer(opts = {})
 new({
 :browser_name => "internet explorer",
 :platform => :windows
 }.merge(opts))
end

.iphone(opts = {}) ⇒ Object

46
47
48
49
50
51
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 46
def iphone(opts = {})
 new({
 :browser_name => "iphone",
 :platform => :mac
 }.merge(opts))
end

.json_create(data) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

64
65
66
67
68
69
70
71
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 64
def json_create(data)
 new(
 :browser_name => data["browserName"],
 :version => data["version"],
 :platform => data["platform"].downcase.to_sym,
 :javascript_enabled => data["javascriptEnabled"]
 )
end

.safari(opts = {}) ⇒ Object

39
40
41
42
43
44
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 39
def safari(opts = {})
 new({
 :browser_name => "safari",
 :platform => :mac
 }.merge(opts))
end

Instance Method Details

#to_json(*args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

93
94
95
96
97
98
99
100
# File 'lib/selenium/webdriver/remote/capabilities.rb', line 93
def to_json(*args)
 {
 "browserName" => browser_name,
 "version" => version,
 "platform" => platform.to_s.upcase,
 "javascriptEnabled" => javascript?
 }.to_json(*args)
end

AltStyle によって変換されたページ (->オリジナル) /