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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e16b32dabf298054ed5e1d29154cba02910c1820
4
- data.tar.gz: 2b4a3b62cdaeca0b9339abc309eefff40a6d7aaa
3
+ metadata.gz: 66624ff64ae020984d9fef2a0519f18955074fb7
4
+ data.tar.gz: e34f21d327306298b6305b5add3aef01fab0ea5c
5
5
  SHA512:
6
- metadata.gz: d13a6b8b6c4cfadc7a995654c2a0f745861c4aadbee9e725d452cb895d2d43ec0141027245a3d39bb0e5d8ad3ba423d7e53c42846e97f52836e43949e18aa77d
7
- data.tar.gz: a7adb7894c79e32000cb61d8d54d20c803886d4aa3be30b226e3d526525483e529ea22442250fe4cefca2ed5d90489a1d60fffcfb5486e78fee658d407f3f3ed
6
+ metadata.gz: 38f8343d3f554a483881dcdfa5e71483c8fea2678e97f6f6cb247ab397fcd68ac3f412ceff8c0b10d917c542c2cfbb04c3dfda89eda9aea5fcc42826c0a6de84
7
+ data.tar.gz: e98ccee7ae47933bd2132d9a26bc3df0130a0bc6f79071bc76b6f88c83dec84b3ba82e8348f443b7dc5e8353186044339bc42c51bc2de8f63dcacc4ea3ad81b7
@@ -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
- backend.extract_element_attribute element!, _name
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
 
@@ -1,3 +1,3 @@
1
1
  module Pincers
2
- VERSION = "0.4.4"
2
+ VERSION = "0.4.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pincers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ignacio Baixas