pincers 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pincers/backend/base.rb +4 -0
- data/lib/pincers/backend/webdriver.rb +4 -0
- data/lib/pincers/core/search_context.rb +10 -2
- data/lib/pincers/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66624ff64ae020984d9fef2a0519f18955074fb7
|
4
|
+
data.tar.gz: e34f21d327306298b6305b5add3aef01fab0ea5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38f8343d3f554a483881dcdfa5e71483c8fea2678e97f6f6cb247ab397fcd68ac3f412ceff8c0b10d917c542c2cfbb04c3dfda89eda9aea5fcc42826c0a6de84
|
7
|
+
data.tar.gz: e98ccee7ae47933bd2132d9a26bc3df0130a0bc6f79071bc76b6f88c83dec84b3ba82e8348f443b7dc5e8353186044339bc42c51bc2de8f63dcacc4ea3ad81b7
|
data/lib/pincers/backend/base.rb
CHANGED
@@ -72,6 +72,10 @@ module Pincers::Backend
|
|
72
72
|
ensure_implementation :extract_element_attribute
|
73
73
|
end
|
74
74
|
|
75
|
+
def set_element_attribute(_element, _name, _value)
|
76
|
+
ensure_implementation :set_element_attribute
|
77
|
+
end
|
78
|
+
|
75
79
|
def clear_input(_element)
|
76
80
|
ensure_implementation :clear_input
|
77
81
|
end
|
@@ -79,6 +79,10 @@ module Pincers::Backend
|
|
79
79
|
_element[_name]
|
80
80
|
end
|
81
81
|
|
82
|
+
def set_element_attribute(_element, _name, _value)
|
83
|
+
driver.execute_script("arguments[0].setAttribute('#{_name}', #{_value.to_json})", _element)
|
84
|
+
end
|
85
|
+
|
82
86
|
def element_is_actionable?(_element)
|
83
87
|
# this is the base requisite in webdriver for actionable elements:
|
84
88
|
# non displayed items will always error on action
|
@@ -73,6 +73,10 @@ module Pincers::Core
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
def []=(key, value)
|
77
|
+
attribute key, value
|
78
|
+
end
|
79
|
+
|
76
80
|
def first
|
77
81
|
wait?(:present) unless frozen? or advanced_mode?
|
78
82
|
if element.nil? then nil else wrap_siblings [element] end
|
@@ -100,9 +104,13 @@ module Pincers::Core
|
|
100
104
|
end
|
101
105
|
end
|
102
106
|
|
103
|
-
def attribute(_name)
|
107
|
+
def attribute(_name, _value=nil)
|
104
108
|
wrap_errors do
|
105
|
-
|
109
|
+
if _value.nil?
|
110
|
+
backend.extract_element_attribute element!, _name
|
111
|
+
else
|
112
|
+
backend.set_element_attribute element!, _name, _value
|
113
|
+
end
|
106
114
|
end
|
107
115
|
end
|
108
116
|
|
data/lib/pincers/version.rb
CHANGED