Skip to content

Commit cf257ff

Browse files
authored
fix unexpected method missing (#132)
* fix unexpected method missing * fix rubocop
1 parent 03e1a1a commit cf257ff

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
55
### Enhancements
66

77
### Bug fixes
8+
- fix unexpedted method missing against `:to_hash`
89

910
### Deprecations
1011

lib/appium_lib_core/patch.rb

+8-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ class Selenium::WebDriver::Element
2929
# e.resource_id # call `e.attribute "resource-id"`
3030
#
3131
def method_missing(method_name)
32-
respond_to?(method_name) ? attribute(method_name.to_s.tr('_', '-')) : super
32+
white_list = [:content_desc, :long_clickable, :resource_id, :selection_start, :selection_end]
33+
attribute_name = white_list.include?(method_name) ? method_name.to_s.tr('_', '-') : method_name
34+
35+
ignore_list = [:to_hash]
36+
37+
return if ignore_list.include? method_name
38+
39+
respond_to?(method_name) ? attribute(attribute_name) : super
3340
end
3441

3542
def respond_to_missing?(*)

0 commit comments

Comments
 (0)