arachnid2 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +15 -0
- data/lib/arachnid2/version.rb +1 -1
- data/lib/arachnid2/watir.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 917f030ae3bfe4eb2183020eaab33463abd80940f2d3ad228ba7e86fcb9d1c3d
|
4
|
+
data.tar.gz: dd7f349e22f52cf54c45740c4393371f9547c7b5f649048de92863e6a41facc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d868813ceba88a7a078e666626c5de3bad85dbf3b2e834626dab9672f6a5b4f32858c0262bc46831b4c7294e4b8b349cfeaab8ef7625eeada588e9604cfdc525
|
7
|
+
data.tar.gz: 1c1b3221ba6db4a12673197162e2be0328879124bd5280f71c63a34d801d4ed74f0cf6526eaff197cca7d805c1dc370f511c66e37467b42856735fc421bfa586
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -212,6 +212,21 @@ And it accepts an argument to make browse headlessly
|
|
212
212
|
opts = { headless: true }
|
213
213
|
```
|
214
214
|
|
215
|
+
##### `agent`
|
216
|
+
|
217
|
+
It accepts an argument mapped to Webdriver::UserAgent::Driver's `agent` option
|
218
|
+
|
219
|
+
```ruby
|
220
|
+
opts = { agent: :desktop }
|
221
|
+
```
|
222
|
+
##### `orientation`
|
223
|
+
|
224
|
+
And it accepts an argument mapped to Webdriver::UserAgent::Driver's `orientation` option
|
225
|
+
|
226
|
+
```ruby
|
227
|
+
opts = { orientation: :landscape }
|
228
|
+
```
|
229
|
+
|
215
230
|
##### `followlocation` and `max_concurrency`
|
216
231
|
|
217
232
|
These options do not apply to Watir, and will be ignored.
|
data/lib/arachnid2/version.rb
CHANGED
data/lib/arachnid2/watir.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
class Arachnid2
|
2
2
|
class Watir
|
3
|
+
DEFAULT_AGENT = :desktop
|
4
|
+
DEFAULT_ORIENTATION = :landscape
|
5
|
+
|
3
6
|
include Arachnid2::Exoskeleton
|
4
7
|
|
5
8
|
def initialize(url)
|
@@ -73,11 +76,15 @@ class Arachnid2
|
|
73
76
|
|
74
77
|
def driver
|
75
78
|
unless @driver
|
76
|
-
language
|
77
|
-
user_agent
|
79
|
+
language = @options.dig(:headers, "Accept-Language") || DEFAULT_LANGUAGE
|
80
|
+
user_agent = @options.dig(:headers, "User-Agent") || DEFAULT_USER_AGENT
|
81
|
+
agent = @options.dig(:agent) || DEFAULT_AGENT
|
82
|
+
orientation = @options.dig(:orientation) || DEFAULT_ORIENTATION
|
78
83
|
|
79
84
|
@driver = Webdriver::UserAgent.driver(
|
80
85
|
browser: browser_type,
|
86
|
+
agent: agent,
|
87
|
+
orientation: orientation,
|
81
88
|
accept_language_string: language,
|
82
89
|
user_agent_string: user_agent
|
83
90
|
)
|