watir-formhandler 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +112 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d2050dd1981a2848022f0b1f78b87bc482660a7
|
4
|
+
data.tar.gz: 4cec0cfc37b141431cd7ec1f65aa88f9a6d4b4d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6373c582036eb1f2daaa31b86d664084b8f102fd14976dead7dd88747579310754093c938c10cb3efb48968742ac5d4fdb947422cd99f66c7721db77e1a118f
|
7
|
+
data.tar.gz: 51e5639297a33983025b7b35fd114fd5a4448ee469e870c3ce3b90c0dbaae48fc0525199d03793f99a31748953d52a0e9bb94d0a16dd24c29db42d8093cc2ad5
|
data/README.md
CHANGED
@@ -1,6 +1,116 @@
|
|
1
|
-
|
1
|
+
![Code Climate](https://codeclimate.com/github/Dervol03/watir-formhandler/badges/gpa.svg)](https://codeclimate.com/github/Dervol03/watir-formhandler)
|
2
2
|
|
3
3
|
watir-formhandler
|
4
4
|
=================
|
5
5
|
|
6
|
-
|
6
|
+
Extends some Watir classes to provide a more comfortale handling for forms and their fields.
|
7
|
+
|
8
|
+
|
9
|
+
## Table of Content
|
10
|
+
|
11
|
+
* [Installation](#installation)
|
12
|
+
* [Usage](#usage)
|
13
|
+
* [#set](#set)
|
14
|
+
* [#field_value](#field_value)
|
15
|
+
* [#field](#field)
|
16
|
+
* [#fill_in](#fill_in)
|
17
|
+
* [OptionGroup](#optiongroup)
|
18
|
+
* [:start_node](#start_node)
|
19
|
+
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
Install it from your command line
|
24
|
+
|
25
|
+
gem install watir-formhandler
|
26
|
+
|
27
|
+
Install it via Gemfile
|
28
|
+
|
29
|
+
gem 'watir-formhandler'
|
30
|
+
|
31
|
+
|
32
|
+
## Usage
|
33
|
+
|
34
|
+
Simply require it wherever you want to use it:
|
35
|
+
|
36
|
+
require 'watir-formhandler'
|
37
|
+
|
38
|
+
|
39
|
+
### #set
|
40
|
+
|
41
|
+
All standard HTML form fields now share a common _#set_ interface to change its value, no matter
|
42
|
+
which subtype the field actually has:
|
43
|
+
|
44
|
+
browser = Watir::Browser.new('example_site')
|
45
|
+
|
46
|
+
browser.text_field(id: 'some_textfield').set('Some Text')
|
47
|
+
browser.checkbox(id: 'check_me').set(true)
|
48
|
+
browser.select(id: 'select_stuff').set('Option1')
|
49
|
+
|
50
|
+
|
51
|
+
### #field_value
|
52
|
+
|
53
|
+
All standard HTML form fields now share a common _#field_value_ interface which returns the
|
54
|
+
currently set value. But be prudent, the data type may vary, just like the customized value methods.
|
55
|
+
|
56
|
+
browser = Watir::Browser.new('example_site')
|
57
|
+
|
58
|
+
browser.text_field(id: 'my_text').field_value # String
|
59
|
+
browser.checkbox(id: 'check_me').field_value # true/false
|
60
|
+
browser.select(id: 'selection').field_value # String if only one option is selected
|
61
|
+
browser.select(id: 'multiple').field_value # Array of Strings for several options
|
62
|
+
|
63
|
+
|
64
|
+
### #field
|
65
|
+
|
66
|
+
All Containers now have a method to determine a form field by their labels or their placeholders,
|
67
|
+
returning the appropriate Watir sub-type class.
|
68
|
+
|
69
|
+
browser = Watir::Browser.new('example_site')
|
70
|
+
form = browser.form(id: 'my_form')
|
71
|
+
|
72
|
+
form.field('Some Text Field Label') # returns TextField if found
|
73
|
+
form.field('Some Checkbox Label') # returns Checkbox if found
|
74
|
+
form.field('Placeholder Text', placeholder: true) # returns TextField containing a placeholder
|
75
|
+
# attribute with 'Placeholder Text'
|
76
|
+
|
77
|
+
|
78
|
+
### #fill_in
|
79
|
+
|
80
|
+
All Containers now have a method to search a form field by its name or label and change its value.
|
81
|
+
|
82
|
+
browser = Watir::Browser.new('example_site')
|
83
|
+
form = browser.form(id: 'my_form')
|
84
|
+
|
85
|
+
form.fill_in('Some Text Field', 'Some text') # enters 'Some text' into the TextField with
|
86
|
+
# label 'Some Text Field'
|
87
|
+
|
88
|
+
form.fill_in('Some Text Field', 'Some text', placeholder: true) # enters 'Some text' into the
|
89
|
+
# TextField with placeholder
|
90
|
+
# 'Some Text Field'
|
91
|
+
|
92
|
+
|
93
|
+
### OptionGroup
|
94
|
+
|
95
|
+
A new Container sub class, which represents a group of radio buttons and/or checkboxes. Such a group
|
96
|
+
may always be referred to, however, to prevent conflicts, _#field_ and _#fill_in_ will only search
|
97
|
+
for these kind of groups, if the respective options has been activated.
|
98
|
+
|
99
|
+
browser = Watir::Browser.new('example_site')
|
100
|
+
form = browser.form(id: 'my_form')
|
101
|
+
|
102
|
+
form.field('OptionsGroupElement') # will return the Checkbox or Radio
|
103
|
+
# which has label 'OptionsGroupElement'
|
104
|
+
|
105
|
+
form.field('OptionsGroupElement', include_groups: true) # returns OptionGroup node to which
|
106
|
+
# the Checkbox/Radio with label
|
107
|
+
# 'OptiongsGroupElement' belongs to.
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
### :start_node
|
112
|
+
|
113
|
+
The new methods _#field_ and _#fill_in_ will start their search for the specified label with the
|
114
|
+
given String on the Container on which it is called, by default. However, you may specify an
|
115
|
+
arbitrary _start_node_ from which to start, which will probably be most useful when calling the
|
116
|
+
methods directly on your Watir::Browser instance.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: watir-formhandler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yves Komenda
|
@@ -38,7 +38,9 @@ dependencies:
|
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.6.11
|
41
|
-
description:
|
41
|
+
description: |-
|
42
|
+
Adds some convenience methods to fill out forms in Watir.
|
43
|
+
Last changes: added sober documentation.
|
42
44
|
email:
|
43
45
|
- b_d_v@web.de
|
44
46
|
executables: []
|
@@ -81,7 +83,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
83
|
requirements:
|
82
84
|
- - '>='
|
83
85
|
- !ruby/object:Gem::Version
|
84
|
-
version:
|
86
|
+
version: 2.0.0
|
85
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
88
|
requirements:
|
87
89
|
- - '>='
|