webaccount 0.3.1 → 0.5.0
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/CHANGELOG +115 -0
- data/Gemfile +2 -0
- data/LICENSE +21 -0
- data/README.md +198 -0
- data/Rakefile +9 -0
- data/lib/Thoran/Selenium/WebDriver/Driver/Attempt/attempt.rb +29 -19
- data/lib/Thoran/Selenium/WebDriver/Driver/ElementPresentQ/element_presentQ.rb +37 -0
- data/lib/Thoran/Selenium.rb +9 -6
- data/lib/web_account.rb +1 -1
- data/lib/webaccount/VERSION.rb +6 -0
- data/lib/{WebAccount.rb → webaccount.rb} +69 -39
- data/test/Thoran/Selenium/WebDriver/Driver/Attempt_test.rb +169 -0
- data/test/webaccount_test.rb +45 -0
- data/webaccount.gemspec +48 -0
- metadata +60 -19
- data/lib/Thoran/Array/AllButFirst/all_but_first.rb +0 -28
- data/lib/Thoran/Array/FirstX/firstX.rb +0 -21
- data/lib/Thoran/Selenium/WebDriver/Remote/W3C/Bridge/ConvertLocators/convert_locators.rb +0 -51
- data/lib/Thoran/Selenium/WebDriver/SearchContext/ElementPresentQ/element_presentQ.rb +0 -39
- data/lib/Thoran/Selenium/WebDriver/SearchContext/ElementsPresentQ/elements_presentQ.rb +0 -39
- data/lib/Thoran/Selenium/WebDriver/Setup/setup.rb +0 -66
- data/lib/Thoran/String/ToConst/to_const.rb +0 -47
- data/lib/WebAccount/VERSION.rb +0 -5
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Thoran/Selenium/WebDriver/SearchContext/ElementPresentQ/element_presentQ.rb
|
|
2
|
-
# Thoran::Selenium::WebDriver::SearchContext::ElementPresentQ.element_present?
|
|
3
|
-
|
|
4
|
-
# 20200418
|
|
5
|
-
# 0.0.0
|
|
6
|
-
|
|
7
|
-
# Examples:
|
|
8
|
-
# 1. driver.element_present?(:xpath, '//a[@id="submit"]')
|
|
9
|
-
# 2. driver.element_present?(:id, @logout_button_id)
|
|
10
|
-
|
|
11
|
-
# Changes:
|
|
12
|
-
# 1. + Thoran namespace.
|
|
13
|
-
|
|
14
|
-
module Thoran
|
|
15
|
-
module Selenium
|
|
16
|
-
module WebDriver
|
|
17
|
-
module SearchContext
|
|
18
|
-
module ElementPresentQ
|
|
19
|
-
|
|
20
|
-
def element_present?(selector_type, selector)
|
|
21
|
-
bridge.find_element_by(selector_type, selector)
|
|
22
|
-
true
|
|
23
|
-
rescue ::Selenium::WebDriver::Error::NoSuchElementError
|
|
24
|
-
false
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
module Selenium
|
|
34
|
-
module WebDriver
|
|
35
|
-
class Driver
|
|
36
|
-
include Thoran::Selenium::WebDriver::SearchContext::ElementPresentQ
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Thoran/Selenium/WebDriver/SearchContext/ElementsPresentQ/elements_presentQ.rb
|
|
2
|
-
# Thoran::Selenium::WebDriver::SearchContext::ElementsPresentQ.elements_present?
|
|
3
|
-
|
|
4
|
-
# 20200418
|
|
5
|
-
# 0.0.0
|
|
6
|
-
|
|
7
|
-
# Examples:
|
|
8
|
-
# 1. driver.elements_present?(:xpath, '//li[@class="item"]')
|
|
9
|
-
# 2. driver.elements_present?(:css, 'li.item')
|
|
10
|
-
|
|
11
|
-
# Changes:
|
|
12
|
-
# 1. + Thoran namespace.
|
|
13
|
-
|
|
14
|
-
module Thoran
|
|
15
|
-
module Selenium
|
|
16
|
-
module WebDriver
|
|
17
|
-
module SearchContext
|
|
18
|
-
module ElementsPresentQ
|
|
19
|
-
|
|
20
|
-
def elements_present?(selector_type, selector)
|
|
21
|
-
bridge.find_elements_by(selector_type, selector)
|
|
22
|
-
true
|
|
23
|
-
rescue ::Selenium::WebDriver::Error::NoSuchElementError
|
|
24
|
-
false
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
module Selenium
|
|
34
|
-
module WebDriver
|
|
35
|
-
class Driver
|
|
36
|
-
include Thoran::Selenium::WebDriver::SearchContext::ElementsPresentQ
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# Thoran/Selenium/WebDriver/Setup/setup.rb
|
|
2
|
-
# Thoran::Selenium::WebDriver.setup
|
|
3
|
-
|
|
4
|
-
# 20200419
|
|
5
|
-
# 0.0.1
|
|
6
|
-
|
|
7
|
-
# Usage:
|
|
8
|
-
# 1. Binary is in the path:
|
|
9
|
-
# Selenium::WebDriver.setup('chrome') # String - lowercase
|
|
10
|
-
# Selenium::WebDriver.setup('Chrome') # String - capitalised
|
|
11
|
-
# Selenium::WebDriver.setup(:chrome) # Symbol - lowercase
|
|
12
|
-
# Selenium::WebDriver.setup(:Chrome) # Symbol - capitalised
|
|
13
|
-
# 2. Binary is not in the path:
|
|
14
|
-
# Selenium::WebDriver.setup('~/Applications/Firefox.app/Contents/MacOS/firefox-bin')
|
|
15
|
-
|
|
16
|
-
# Changes:
|
|
17
|
-
# 1. + Thoran namespace.
|
|
18
|
-
|
|
19
|
-
require 'selenium-webdriver'
|
|
20
|
-
require 'Thoran/String/ToConst/to_const'
|
|
21
|
-
|
|
22
|
-
module Thoran
|
|
23
|
-
module Selenium
|
|
24
|
-
module WebDriver
|
|
25
|
-
module Setup
|
|
26
|
-
|
|
27
|
-
def setup(path_or_browser)
|
|
28
|
-
if File.exist?(File.expand_path(path_or_browser.to_s))
|
|
29
|
-
path = path_or_browser
|
|
30
|
-
at(path)
|
|
31
|
-
::Selenium::WebDriver.for(selenium_browser(path))
|
|
32
|
-
else
|
|
33
|
-
browser = path_or_browser.to_sym.downcase
|
|
34
|
-
::Selenium::WebDriver.for(browser)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
private
|
|
39
|
-
|
|
40
|
-
def at(path)
|
|
41
|
-
selenium_binary_constant(path).path = File.expand_path(path)
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def selenium_browser(path)
|
|
45
|
-
case path
|
|
46
|
-
when /chrome/i; :chrome
|
|
47
|
-
when /firefox/i; :firefox
|
|
48
|
-
when /safari/i; :safari
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# This method seem to be necessary only to Firefox, since there are no equivalent constants for Safari or Chrome.
|
|
53
|
-
def selenium_binary_constant(path)
|
|
54
|
-
"Selenium::WebDriver::#{selenium_browser(path).to_s.capitalize}::Binary".to_const
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
module Selenium
|
|
63
|
-
module WebDriver
|
|
64
|
-
extend Thoran::Selenium::WebDriver::Setup
|
|
65
|
-
end
|
|
66
|
-
end
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# Thoran/String/ToConst/to_const.rb
|
|
2
|
-
# Thoran::String::ToConst#to_const
|
|
3
|
-
|
|
4
|
-
# 20141223
|
|
5
|
-
# 0.2.0
|
|
6
|
-
|
|
7
|
-
# Description: This takes a string and returns a constant, with unlimited namespacing.
|
|
8
|
-
|
|
9
|
-
# History: Derived from Object#to_const 0.3.0, and superceding Object#to_const.
|
|
10
|
-
|
|
11
|
-
# Changes:
|
|
12
|
-
# 1. + Thoran namespace.
|
|
13
|
-
|
|
14
|
-
# Todo:
|
|
15
|
-
# 1. This only works for two levels of constants. Three and you're stuffed. So, this needs to be recursive...
|
|
16
|
-
# Done iteratively as of 0.1.0.
|
|
17
|
-
# 2. Make this work for symbols. However, this will only work if there's no namespacing. ie. :A is OK, but :A::B is not.
|
|
18
|
-
|
|
19
|
-
# Discussion:
|
|
20
|
-
# 1. Should this go separately into classes for which ::const_get will work and be removed from Object? Done as of 0.1.0.
|
|
21
|
-
|
|
22
|
-
require 'Thoran/Array/AllButFirst/all_but_first'
|
|
23
|
-
|
|
24
|
-
module Thoran
|
|
25
|
-
module String
|
|
26
|
-
module ToConst
|
|
27
|
-
|
|
28
|
-
def to_const
|
|
29
|
-
if self =~ /::/
|
|
30
|
-
constants = self.split('::')
|
|
31
|
-
constant = Object.const_get(constants.first)
|
|
32
|
-
constants = constants.all_but_first
|
|
33
|
-
until constants.empty? do
|
|
34
|
-
constant = constant.const_get(constants.shift)
|
|
35
|
-
end
|
|
36
|
-
else
|
|
37
|
-
constant = Object.const_get(self)
|
|
38
|
-
end
|
|
39
|
-
constant
|
|
40
|
-
end
|
|
41
|
-
alias_method :to_constant, :to_const
|
|
42
|
-
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
String.send(:include, Thoran::String::ToConst)
|