selenium-webdriver 2.45.0 → 2.46.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/CHANGES +18 -3
  2. data/Gemfile.lock +5 -5
  3. data/LICENSE +202 -0
  4. data/README.md +13 -8
  5. data/lib/selenium-client.rb +17 -0
  6. data/lib/selenium-webdriver.rb +17 -0
  7. data/lib/selenium/client.rb +17 -0
  8. data/lib/selenium/client/base.rb +17 -0
  9. data/lib/selenium/client/driver.rb +17 -0
  10. data/lib/selenium/client/errors.rb +17 -0
  11. data/lib/selenium/client/extensions.rb +1 -3
  12. data/lib/selenium/client/idiomatic.rb +17 -0
  13. data/lib/selenium/client/javascript_expression_builder.rb +17 -0
  14. data/lib/selenium/client/javascript_frameworks/jquery.rb +17 -0
  15. data/lib/selenium/client/javascript_frameworks/prototype.rb +17 -0
  16. data/lib/selenium/client/legacy_driver.rb +15 -15
  17. data/lib/selenium/client/protocol.rb +17 -0
  18. data/lib/selenium/client/selenium_helper.rb +18 -5
  19. data/lib/selenium/rake/server_task.rb +17 -0
  20. data/lib/selenium/server.rb +17 -0
  21. data/lib/selenium/webdriver.rb +18 -3
  22. data/lib/selenium/webdriver/android.rb +17 -0
  23. data/lib/selenium/webdriver/android/bridge.rb +18 -1
  24. data/lib/selenium/webdriver/chrome.rb +20 -3
  25. data/lib/selenium/webdriver/chrome/bridge.rb +17 -0
  26. data/lib/selenium/webdriver/chrome/profile.rb +18 -1
  27. data/lib/selenium/webdriver/chrome/service.rb +64 -21
  28. data/lib/selenium/webdriver/common.rb +19 -1
  29. data/lib/selenium/webdriver/common/action_builder.rb +17 -0
  30. data/lib/selenium/webdriver/common/alert.rb +17 -0
  31. data/lib/selenium/webdriver/common/bridge_helper.rb +18 -1
  32. data/lib/selenium/webdriver/common/core_ext/base64.rb +17 -0
  33. data/lib/selenium/webdriver/common/core_ext/dir.rb +17 -0
  34. data/lib/selenium/webdriver/common/core_ext/string.rb +17 -0
  35. data/lib/selenium/webdriver/common/driver.rb +18 -3
  36. data/lib/selenium/webdriver/common/driver_extensions/has_input_devices.rb +17 -0
  37. data/lib/selenium/webdriver/common/driver_extensions/has_location.rb +21 -4
  38. data/lib/selenium/webdriver/common/driver_extensions/has_network_connection.rb +57 -0
  39. data/lib/selenium/webdriver/common/driver_extensions/has_remote_status.rb +21 -4
  40. data/lib/selenium/webdriver/common/driver_extensions/has_session_id.rb +17 -0
  41. data/lib/selenium/webdriver/common/driver_extensions/has_touch_screen.rb +21 -4
  42. data/lib/selenium/webdriver/common/driver_extensions/has_web_storage.rb +17 -0
  43. data/lib/selenium/webdriver/common/driver_extensions/rotatable.rb +17 -0
  44. data/lib/selenium/webdriver/common/driver_extensions/takes_screenshot.rb +17 -0
  45. data/lib/selenium/webdriver/common/driver_extensions/uploads_files.rb +17 -0
  46. data/lib/selenium/webdriver/common/element.rb +23 -3
  47. data/lib/selenium/webdriver/common/error.rb +17 -0
  48. data/lib/selenium/webdriver/common/file_reaper.rb +17 -0
  49. data/lib/selenium/webdriver/common/html5/local_storage.rb +21 -4
  50. data/lib/selenium/webdriver/common/html5/location.rb +17 -0
  51. data/lib/selenium/webdriver/common/html5/session_storage.rb +21 -4
  52. data/lib/selenium/webdriver/common/html5/shared_web_storage.rb +22 -5
  53. data/lib/selenium/webdriver/common/json_helper.rb +20 -3
  54. data/lib/selenium/webdriver/common/keyboard.rb +17 -0
  55. data/lib/selenium/webdriver/common/keys.rb +16 -1
  56. data/lib/selenium/webdriver/common/log_entry.rb +21 -3
  57. data/lib/selenium/webdriver/common/logs.rb +20 -3
  58. data/lib/selenium/webdriver/common/mouse.rb +17 -0
  59. data/lib/selenium/webdriver/common/navigation.rb +17 -0
  60. data/lib/selenium/webdriver/common/options.rb +17 -0
  61. data/lib/selenium/webdriver/common/platform.rb +17 -0
  62. data/lib/selenium/webdriver/common/port_prober.rb +17 -0
  63. data/lib/selenium/webdriver/common/profile_helper.rb +17 -0
  64. data/lib/selenium/webdriver/common/proxy.rb +17 -0
  65. data/lib/selenium/webdriver/common/search_context.rb +17 -0
  66. data/lib/selenium/webdriver/common/socket_lock.rb +76 -0
  67. data/lib/selenium/webdriver/common/socket_poller.rb +17 -0
  68. data/lib/selenium/webdriver/common/target_locator.rb +17 -0
  69. data/lib/selenium/webdriver/common/timeouts.rb +17 -0
  70. data/lib/selenium/webdriver/common/touch_action_builder.rb +20 -3
  71. data/lib/selenium/webdriver/common/touch_screen.rb +20 -3
  72. data/lib/selenium/webdriver/common/wait.rb +17 -0
  73. data/lib/selenium/webdriver/common/window.rb +20 -4
  74. data/lib/selenium/webdriver/common/zipper.rb +17 -0
  75. data/lib/selenium/webdriver/firefox.rb +20 -4
  76. data/lib/selenium/webdriver/firefox/binary.rb +17 -0
  77. data/lib/selenium/webdriver/firefox/bridge.rb +18 -3
  78. data/lib/selenium/webdriver/firefox/extension.rb +17 -0
  79. data/lib/selenium/webdriver/firefox/extension/prefs.json +2 -0
  80. data/lib/selenium/webdriver/firefox/extension/webdriver.xpi +0 -0
  81. data/lib/selenium/webdriver/firefox/launcher.rb +17 -8
  82. data/lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so +0 -0
  83. data/lib/selenium/webdriver/firefox/profile.rb +17 -0
  84. data/lib/selenium/webdriver/firefox/profiles_ini.rb +17 -0
  85. data/lib/selenium/webdriver/firefox/util.rb +17 -0
  86. data/lib/selenium/webdriver/ie.rb +21 -3
  87. data/lib/selenium/webdriver/ie/bridge.rb +17 -0
  88. data/lib/selenium/webdriver/ie/server.rb +21 -4
  89. data/lib/selenium/webdriver/iphone.rb +17 -0
  90. data/lib/selenium/webdriver/iphone/bridge.rb +17 -0
  91. data/lib/selenium/webdriver/phantomjs.rb +20 -3
  92. data/lib/selenium/webdriver/phantomjs/bridge.rb +17 -0
  93. data/lib/selenium/webdriver/phantomjs/service.rb +17 -0
  94. data/lib/selenium/webdriver/remote.rb +20 -5
  95. data/lib/selenium/webdriver/remote/bridge.rb +24 -9
  96. data/lib/selenium/webdriver/remote/capabilities.rb +17 -9
  97. data/lib/selenium/webdriver/remote/commands.rb +20 -4
  98. data/lib/selenium/webdriver/remote/http/common.rb +18 -1
  99. data/lib/selenium/webdriver/remote/http/curb.rb +17 -0
  100. data/lib/selenium/webdriver/remote/http/default.rb +26 -4
  101. data/lib/selenium/webdriver/remote/http/persistent.rb +17 -0
  102. data/lib/selenium/webdriver/remote/response.rb +17 -0
  103. data/lib/selenium/webdriver/remote/server_error.rb +19 -2
  104. data/lib/selenium/webdriver/safari.rb +20 -3
  105. data/lib/selenium/webdriver/safari/bridge.rb +21 -4
  106. data/lib/selenium/webdriver/safari/browser.rb +21 -5
  107. data/lib/selenium/webdriver/safari/extensions.rb +21 -4
  108. data/lib/selenium/webdriver/safari/options.rb +21 -4
  109. data/lib/selenium/webdriver/safari/resources/SafariDriver.safariextz +0 -0
  110. data/lib/selenium/webdriver/safari/resources/client.js +1 -1
  111. data/lib/selenium/webdriver/safari/server.rb +21 -4
  112. data/lib/selenium/webdriver/support.rb +17 -0
  113. data/lib/selenium/webdriver/support/abstract_event_listener.rb +21 -4
  114. data/lib/selenium/webdriver/support/block_event_listener.rb +21 -4
  115. data/lib/selenium/webdriver/support/color.rb +22 -5
  116. data/lib/selenium/webdriver/support/event_firing_bridge.rb +17 -0
  117. data/lib/selenium/webdriver/support/select.rb +21 -4
  118. data/selenium-webdriver.gemspec +2 -2
  119. metadata +78 -78
  120. data/lib/selenium/webdriver/opera.rb +0 -24
  121. data/lib/selenium/webdriver/opera/bridge.rb +0 -112
  122. data/lib/selenium/webdriver/opera/service.rb +0 -49
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  module Selenium
2
19
  module Client
3
20
 
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  module Selenium
2
19
  module Client
3
20
 
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  module Selenium
2
19
  module Client
3
20
  module JavascriptFrameworks
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  module Selenium
2
19
  module Client
3
20
  module JavascriptFrameworks
@@ -1,18 +1,19 @@
1
-
2
- # Copyright 2011 Software Freedom Conservancy
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
9
8
  #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
9
+ # http://www.apache.org/licenses/LICENSE-2.0
15
10
  #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
16
17
 
17
18
  # -----------------
18
19
  # Original code by Aslak Hellesoy and Darren Hobbs
@@ -1557,8 +1558,7 @@ module Selenium
1557
1558
  # works in Firefox when running in chrome mode, and in IE non-HTA using
1558
1559
  # the EXPERIMENTAL "Snapsie" utility. The Firefox implementation is mostly
1559
1560
  # borrowed from the Screengrab! Firefox extension. Please see
1560
- # http://www.screengrab.org and http://snapsie.sourceforge.net/ for
1561
- # details.
1561
+ # http://snapsie.sourceforge.net/ for details.
1562
1562
  #
1563
1563
  # 'filename' is the path to the file to persist the screenshot as. No filename extension will be appended by default. Directories will not be created if they do not exist, and an exception will be thrown, possibly by native code.
1564
1564
  # 'kwargs' is a kwargs string that modifies the way the screenshot is captured. Example: "background=#CCFFDD" . Currently valid options: * background:: the background CSS for the HTML document. This may be useful to set for capturing screenshots of less-than-ideal layouts, for example where absolute positioning causes the calculation of the canvas dimension to fail and a black background is exposed (possibly obscuring black text).
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  module Selenium
2
19
  module Client
3
20
 
@@ -1,7 +1,20 @@
1
- # Defines a mixin module that you can use to write Selenium tests
2
- # without typing "@selenium." in front of every command. Every
3
- # call to a missing method will be automatically sent to the @selenium
4
- # object.
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
5
18
  module Selenium
6
19
  module Client
7
20
 
@@ -31,4 +44,4 @@ module Selenium
31
44
  end
32
45
 
33
46
  end
34
- end
47
+ end
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'selenium/server'
2
19
  require 'rake'
3
20
 
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'childprocess'
2
19
  require 'selenium/webdriver/common/socket_poller'
3
20
  require 'net/http'
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'childprocess'
2
19
  require 'tmpdir'
3
20
  require 'fileutils'
@@ -19,7 +36,6 @@ module Selenium
19
36
  autoload :Firefox, 'selenium/webdriver/firefox'
20
37
  autoload :IE, 'selenium/webdriver/ie'
21
38
  autoload :IPhone, 'selenium/webdriver/iphone'
22
- autoload :Opera, 'selenium/webdriver/opera'
23
39
  autoload :PhantomJS, 'selenium/webdriver/phantomjs'
24
40
  autoload :Remote, 'selenium/webdriver/remote'
25
41
  autoload :Safari, 'selenium/webdriver/safari'
@@ -34,7 +50,7 @@ module Selenium
34
50
  #
35
51
  # Create a new Driver instance with the correct bridge for the given browser
36
52
  #
37
- # @param browser [:ie, :internet_explorer, :remote, :chrome, :firefox, :ff, :android, :iphone, :opera, :phantomjs, :safari]
53
+ # @param browser [:ie, :internet_explorer, :remote, :chrome, :firefox, :ff, :android, :iphone, :phantomjs, :safari]
38
54
  # the driver type to use
39
55
  # @param *rest
40
56
  # arguments passed to Bridge.new
@@ -47,7 +63,6 @@ module Selenium
47
63
  # @see Selenium::WebDriver::Chrome::Bridge
48
64
  # @see Selenium::WebDriver::Android::Bridge
49
65
  # @see Selenium::WebDriver::IPhone::Bridge
50
- # @see Selenium::WebDriver::Opera::Bridge
51
66
  # @see Selenium::WebDriver::PhantomJS::Bridge
52
67
  # @see Selenium::WebDriver::Safari::Bridge
53
68
  #
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  module Selenium
2
19
  module WebDriver
3
20
  module Android
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  module Selenium
2
19
  module WebDriver
3
20
  module Android
@@ -34,7 +51,7 @@ module Selenium
34
51
  DriverExtensions::HasInputDevices,
35
52
  DriverExtensions::HasWebStorage,
36
53
  DriverExtensions::HasLocation,
37
- DriverExtensions::HasBrowserConnection,
54
+ DriverExtensions::HasNetworkConnection,
38
55
  DriverExtensions::HasTouchScreen
39
56
  ]
40
57
  end
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  require 'net/http'
2
19
 
3
20
  require 'selenium/webdriver/chrome/service'
@@ -21,6 +38,6 @@ module Selenium
21
38
  @path ||= nil
22
39
  end
23
40
 
24
- end
25
- end
26
- end
41
+ end # Chrome
42
+ end # WebDriver
43
+ end # Selenium
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  module Selenium
2
19
  module WebDriver
3
20
  module Chrome
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  module Selenium
2
19
  module WebDriver
3
20
  module Chrome
@@ -30,7 +47,7 @@ module Selenium
30
47
  #
31
48
  # Set a preference in the profile.
32
49
  #
33
- # See http://codesearch.google.com/codesearch#OAMlx_jo-ck/src/chrome/common/pref_names.cc&exact_package=chromium
50
+ # See https://src.chromium.org/svn/trunk/src/chrome/common/pref_names.cc
34
51
  #
35
52
 
36
53
  def []=(key, value)
@@ -1,3 +1,20 @@
1
+ # Licensed to the Software Freedom Conservancy (SFC) under one
2
+ # or more contributor license agreements. See the NOTICE file
3
+ # distributed with this work for additional information
4
+ # regarding copyright ownership. The SFC licenses this file
5
+ # to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance
7
+ # with the License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
1
18
  module Selenium
2
19
  module WebDriver
3
20
  module Chrome
@@ -5,14 +22,12 @@ module Selenium
5
22
  #
6
23
  # @api private
7
24
  #
8
-
9
25
  class Service
10
- START_TIMEOUT = 20
11
- STOP_TIMEOUT = 5
12
- DEFAULT_PORT = 9515
13
- MISSING_TEXT = "Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at http://code.google.com/p/selenium/wiki/ChromeDriver."
14
-
15
- attr_reader :uri
26
+ START_TIMEOUT = 20
27
+ SOCKET_LOCK_TIMEOUT = 45
28
+ STOP_TIMEOUT = 5
29
+ DEFAULT_PORT = 9515
30
+ MISSING_TEXT = "Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver."
16
31
 
17
32
  def self.executable_path
18
33
  @executable_path ||= (
@@ -30,33 +45,33 @@ module Selenium
30
45
  end
31
46
 
32
47
  def self.default_service(*extra_args)
33
- new executable_path, PortProber.above(DEFAULT_PORT), *extra_args
48
+ new executable_path, DEFAULT_PORT, *extra_args
34
49
  end
35
50
 
36
51
  def initialize(executable_path, port, *extra_args)
37
- @uri = URI.parse "http://#{Platform.localhost}:#{port}"
38
- server_command = [executable_path, "--port=#{port}", *extra_args]
52
+ @executable_path = executable_path
53
+ @host = Platform.localhost
54
+ @port = Integer(port)
39
55
 
40
- @process = ChildProcess.build(*server_command)
41
- @socket_poller = SocketPoller.new Platform.localhost, port, START_TIMEOUT
56
+ raise Error::WebDriverError, "invalid port: #{@port}" if @port < 1
42
57
 
43
- @process.io.inherit! if $DEBUG == true
58
+ @extra_args = extra_args
44
59
  end
45
60
 
46
61
  def start
47
- @process.start
62
+ Platform.exit_hook { stop } # make sure we don't leave the server running
48
63
 
49
- unless @socket_poller.connected?
50
- raise Error::WebDriverError, "unable to connect to chromedriver #{@uri}"
64
+ socket_lock.locked do
65
+ find_free_port
66
+ start_process
67
+ connect_until_stable
51
68
  end
52
-
53
- Platform.exit_hook { stop } # make sure we don't leave the server running
54
69
  end
55
70
 
56
71
  def stop
57
72
  return if @process.nil? || @process.exited?
58
73
 
59
- Net::HTTP.start(uri.host, uri.port) do |http|
74
+ Net::HTTP.start(@host, @port) do |http|
60
75
  http.open_timeout = STOP_TIMEOUT / 2
61
76
  http.read_timeout = STOP_TIMEOUT / 2
62
77
 
@@ -68,8 +83,36 @@ module Selenium
68
83
  # ok, force quit
69
84
  @process.stop STOP_TIMEOUT
70
85
  end
71
- end # Service
72
86
 
87
+ def uri
88
+ URI.parse "http://#{@host}:#{@port}"
89
+ end
90
+
91
+ def find_free_port
92
+ @port = PortProber.above @port
93
+ end
94
+
95
+ def start_process
96
+ server_command = [@executable_path, "--port=#{@port}", *@extra_args]
97
+ @process = ChildProcess.build(*server_command)
98
+
99
+ @process.io.inherit! if $DEBUG == true
100
+ @process.start
101
+ end
102
+
103
+ def connect_until_stable
104
+ @socket_poller = SocketPoller.new @host, @port, START_TIMEOUT
105
+
106
+ unless @socket_poller.connected?
107
+ raise Error::WebDriverError, "unable to connect to chromedriver #{@host}:#{@port}"
108
+ end
109
+ end
110
+
111
+ def socket_lock
112
+ @socket_lock ||= SocketLock.new(@port - 1, SOCKET_LOCK_TIMEOUT)
113
+ end
114
+
115
+ end # Service
73
116
  end # Chrome
74
117
  end # WebDriver
75
- end # Service
118
+ end # Service