rudra 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rudra.rb +25 -7
- 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: 80b5c7e46548e01a83ab8c8be4ca81cc409ca9f1f234dbc8db44ce826bb2fa3c
|
4
|
+
data.tar.gz: 584f2d9666937c1e644baf16d6988f41d78714bc80808c43a3a32e5b31968a50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf790ff40424a147a557f43009969858ce7748b72e6a8fb0e102408b00bdc2777c2cf32095219af16c441dabc27c9b0824a7ccd12894914543b6d8038f383e0c
|
7
|
+
data.tar.gz: 205775b7873d7eab81d1845069f09d962f655ddab941b9915701d19a236767b038a5e38ae7f5601c829c9a9539867fd7528ced699078386a5f79871c5f828b0a
|
data/lib/rudra.rb
CHANGED
@@ -31,12 +31,12 @@ class Rudra
|
|
31
31
|
# @param [Hash] options the options to initialize Rudra
|
32
32
|
# @option options [Symbol] :browser (:chrome) the supported
|
33
33
|
# browsers: :chrome, :firefox, :safari
|
34
|
-
# @option options [
|
34
|
+
# @option options [Symbol] :locale (:en) the browser locale
|
35
35
|
# @option options [Integer] :timeout (30) implicit_wait timeout
|
36
36
|
# @option options [Boolean] :verbose (true) verbose mode
|
37
37
|
def initialize(options = {})
|
38
38
|
self.browser = options.fetch(:browser, :chrome)
|
39
|
-
self.locale = options.fetch(:locale,
|
39
|
+
self.locale = options.fetch(:locale, :en)
|
40
40
|
|
41
41
|
initialize_driver
|
42
42
|
|
@@ -527,6 +527,12 @@ class Rudra
|
|
527
527
|
), find_element(locator))
|
528
528
|
end
|
529
529
|
|
530
|
+
# Set implicit_wait timeout
|
531
|
+
# @param [Integer] seconds timeout for implicit_wait
|
532
|
+
def implicit_wait(seconds)
|
533
|
+
driver.manage.timeouts.implicit_wait = seconds
|
534
|
+
end
|
535
|
+
|
530
536
|
# Click the given element, identified by locator, via Javascript
|
531
537
|
# @param [String, Selenium::WebDriver::Element] locator the locator to
|
532
538
|
# identify the element or Selenium::WebDriver::Element
|
@@ -569,6 +575,12 @@ class Rudra
|
|
569
575
|
.perform
|
570
576
|
end
|
571
577
|
|
578
|
+
# Set page_load timeout
|
579
|
+
# @param [Integer] seconds timeout for page_load
|
580
|
+
def page_load(seconds)
|
581
|
+
driver.manage.timeouts.page_load = seconds
|
582
|
+
end
|
583
|
+
|
572
584
|
# Get the dimensions and coordinates of the given element,
|
573
585
|
# identfied by locator
|
574
586
|
# @param [String, Selenium::WebDriver::Element] locator the locator to
|
@@ -609,6 +621,12 @@ class Rudra
|
|
609
621
|
action.move_to(element, x, y).context_click.perform
|
610
622
|
end
|
611
623
|
|
624
|
+
# Set script_timeout timeout
|
625
|
+
# @param [Integer] seconds timeout for script_timeout
|
626
|
+
def script_timeout(seconds)
|
627
|
+
driver.manage.timeouts.script_timeout = seconds
|
628
|
+
end
|
629
|
+
|
612
630
|
# Scroll the given element, identfied by locator, into view
|
613
631
|
# @param [String, Selenium::WebDriver::Element] locator the locator to
|
614
632
|
# identify the element or Selenium::WebDriver::Element
|
@@ -1081,16 +1099,16 @@ class Rudra
|
|
1081
1099
|
|
1082
1100
|
def locale=(loc)
|
1083
1101
|
@locale = if browser == :firefox
|
1084
|
-
loc.sub('_', '-').gsub(/(-[a-zA-Z]{2})$/, &:downcase)
|
1102
|
+
loc.to_s.sub('_', '-').gsub(/(-[a-zA-Z]{2})$/, &:downcase)
|
1085
1103
|
else
|
1086
|
-
loc.sub('_', '-').gsub(/(-[a-zA-Z]{2})$/, &:upcase)
|
1104
|
+
loc.to_s.sub('_', '-').gsub(/(-[a-zA-Z]{2})$/, &:upcase)
|
1087
1105
|
end
|
1088
1106
|
end
|
1089
1107
|
|
1090
1108
|
def timeout=(seconds)
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1109
|
+
implicit_wait(seconds)
|
1110
|
+
page_load(seconds)
|
1111
|
+
script_timeout(seconds)
|
1094
1112
|
@timeout = seconds
|
1095
1113
|
end
|
1096
1114
|
|