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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rudra.rb +25 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2d32f8fed6918c55fac1f6de03e6bfb80bac6510a26a74303bd7274a30c1f8fe
4
- data.tar.gz: fcc2148f6701587fb009d09ba1f740250870c013f76853d2b68c7c0027a69192
3
+ metadata.gz: 80b5c7e46548e01a83ab8c8be4ca81cc409ca9f1f234dbc8db44ce826bb2fa3c
4
+ data.tar.gz: 584f2d9666937c1e644baf16d6988f41d78714bc80808c43a3a32e5b31968a50
5
5
  SHA512:
6
- metadata.gz: 6726fe6808e3f643bc4b42470f89bfdf28927650e8fa86fb6524ddd25a18fed6f0e5727d63b62dd21390001986a6496056dc01896b4a9e27913b63648df99759
7
- data.tar.gz: 34a1130c1eca89552e32f49fcd335c874d675b0f4e473b15a2b62d996bca0f0d825f2c0fa111bd8ab20788d9643352193f32a00a229d7bcd4700cf07cfaae846
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 [String] :locale ('en') the browser locale
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, 'en')
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
- driver.manage.timeouts.implicit_wait = seconds
1092
- driver.manage.timeouts.page_load = seconds
1093
- driver.manage.timeouts.script_timeout = seconds
1109
+ implicit_wait(seconds)
1110
+ page_load(seconds)
1111
+ script_timeout(seconds)
1094
1112
  @timeout = seconds
1095
1113
  end
1096
1114
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rudra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Chen