Skip to content

Commit 7b44bf7

Browse files
authored
use default_move_duration (#115)
* use default_move_duration * remove hotfix of page source in w3c * update changelog
1 parent 590e798 commit 7b44bf7

File tree

4 files changed

+9
-20
lines changed

4 files changed

+9
-20
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
66
- Update documentation about `start_recording_screen`
77
- Port `send_keys/type` for active element
88
- Support `find_element/s :image, partial_image`
9+
- Requires `selenium-webdriver 3.14+` because of W3C actions
910

1011
### Bug fixes
1112

appium_lib_core.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
2222
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
2323
spec.require_paths = ['lib']
2424

25-
spec.add_runtime_dependency 'selenium-webdriver', '~> 3.5', '< 3.14'
25+
spec.add_runtime_dependency 'selenium-webdriver', '~> 3.14'
2626
spec.add_runtime_dependency 'faye-websocket', '~> 0.10.0'
2727

2828
spec.add_development_dependency 'bundler', '~> 1.14'

lib/appium_lib_core/common/base/bridge/w3c.rb

+7-15
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@ module Core
33
class Base
44
class Bridge
55
class W3C < ::Selenium::WebDriver::Remote::W3C::Bridge
6-
def self.silence_warnings_redefining(&block)
7-
warn_level = $VERBOSE
8-
$VERBOSE = nil
9-
result = block.call
10-
$VERBOSE = warn_level
11-
result
12-
end
13-
146
include Device::DeviceLock
157
include Device::Keyboard
168
include Device::ImeActions
@@ -26,10 +18,6 @@ def self.silence_warnings_redefining(&block)
2618
include Device::Device
2719
include Device::TouchActions
2820

29-
# Used for default duration of each touch actions
30-
# Override from 250 milliseconds to 50 milliseconds
31-
W3C.silence_warnings_redefining { ::Selenium::WebDriver::PointerActions::DEFAULT_MOVE_DURATION = 0.05 }
32-
3321
def commands(command)
3422
::Appium::Core::Commands::W3C::COMMANDS[command]
3523
end
@@ -48,9 +36,13 @@ def commands(command)
4836
# element = @driver.find_element(:id, "some id")
4937
# @driver.action.click(element).perform # The `click` is a part of `PointerActions`
5038
#
51-
# # You can change the kind as the below.
52-
# @driver.action(kind: :mouse).click(element).perform # The `click` is a part of `PointerActions`
53-
#
39+
def action(async = false)
40+
# Used for default duration of each touch actions
41+
# Override from 250 milliseconds to 50 milliseconds
42+
action_builder = super
43+
action_builder.default_move_duration = 0.05
44+
action_builder
45+
end
5446

5547
# Port from MJSONWP
5648
def get_timeouts

lib/appium_lib_core/common/command/w3c.rb

-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ module W3C
99
status: [:get, 'status'.freeze],
1010
is_element_displayed: [:get, 'session/:session_id/element/:id/displayed'.freeze],
1111

12-
# FIXME: remove after apply https://github.com/SeleniumHQ/selenium/pull/5249
13-
# The fix will be included in selenium-3.8.2
14-
get_page_source: [:get, 'session/:session_id/source'.freeze],
15-
1612
get_timeouts: [:get, 'session/:session_id/timeouts'.freeze],
1713

1814
## Add OSS commands to W3C commands. We can remove them if we would like to remove them from W3C module.

0 commit comments

Comments
 (0)