Ifd_Automation 2.8.2 → 2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/documentation_generator.rb +0 -0
- data/bin/generate.rb +0 -6
- data/bin/helper.rb +0 -0
- data/lib/Ifd_Automation.rb +1 -0
- data/{project/features/step_definitions/IFD_Libraries → lib/Ifd_Automation}/REST_steps.rb +0 -0
- data/{project/features/step_definitions/IFD_Libraries → lib/Ifd_Automation}/SOAP_steps.rb +0 -0
- data/lib/Ifd_Automation/all_steps.rb +0 -0
- data/{project/features/step_definitions/IFD_Libraries → lib/Ifd_Automation}/database_steps.rb +1 -1
- data/{project/features/step_definitions/IFD_Libraries → lib/Ifd_Automation}/dynamic_store_value_steps.rb +0 -0
- data/{project/features/step_definitions/IFD_Libraries → lib/Ifd_Automation}/email_steps.rb +0 -0
- data/{project/features/step_definitions/IFD_Libraries → lib/Ifd_Automation}/file_steps.rb +0 -0
- data/lib/Ifd_Automation/require_libs.rb +0 -0
- data/{project/features/step_definitions/IFD_Libraries → lib/Ifd_Automation}/ssh_steps.rb +0 -0
- data/lib/Ifd_Automation/version.rb +1 -1
- data/lib/Ifd_Automation/web_steps.rb +109 -0
- data/lib/helper/assertion_helper.rb +0 -0
- data/lib/helper/auto_util.rb +0 -0
- data/lib/helper/database_helper.rb +0 -0
- data/lib/helper/file_helper.rb +0 -0
- data/lib/helper/mail_helper.rb +0 -0
- data/lib/helper/rest_helper.rb +0 -0
- data/lib/helper/soap_helper.rb +0 -0
- data/lib/helper/ssh_helper.rb +1 -1
- data/lib/helper/step_fallback.rb +13 -0
- data/lib/helper/tolerance_for_selenium_sync_issues.rb +72 -0
- data/lib/helper/web_steps_helper.rb +539 -325
- data/project/Gemfile +0 -0
- data/project/README.md +5 -21
- data/project/cucumber.yml +3 -3
- data/project/features/TestData/globalData.yml +0 -0
- data/project/features/TestSuite/WebGUI.feature +3 -4
- data/project/features/step_definitions/lib_steps/steps_definition.rb +3 -0
- data/project/features/step_definitions/repositories/project_object.yml +1 -2
- data/project/features/support/env.rb +30 -100
- data/project/features/support/hooks.rb +4 -4
- data/project/features/support/project_config.rb +13 -0
- metadata +30 -23
- data/project/Dockerfile +0 -20
- data/project/docker-compose.yml +0 -7
- data/project/features/Screenshot/sample.jpg +0 -0
- data/project/features/step_definitions/IFD_Libraries/web_steps.rb +0 -98
- data/project/features/step_definitions/lib_steps/actionwords.rb +0 -9
- data/project/features/step_definitions/lib_steps/steps.rb +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ead647aae45a7dabb8912d9a7be482be5460da9cf7d2274daa47bfa3b55f4c85
|
4
|
+
data.tar.gz: 5735834456929b033aa6ddfc677e85c02f9aa3fad5a35ee000cc45fe5abf7e14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d336664be9b300d03336f4f1d5e15df44f6d92d00adb7b749559ea85e4e6e09c8b2799dba66b1f8fec7ffb318e2f97e685eb3c095ff5ec0c69aa66baa94a3f86
|
7
|
+
data.tar.gz: 16bcdf590ac0676206de8f09f6314bdea030a979b3259e25386887667c568e5e1cc7b6dc8c1184f332cf1ffca4243870d3c3205271beba7a264d006cf78eb5ba
|
File without changes
|
data/bin/generate.rb
CHANGED
@@ -25,12 +25,6 @@ def ifd_automation_scaffold
|
|
25
25
|
msg('README.md') do
|
26
26
|
puts "INFOdation Automation created README.md file with template usage\n"
|
27
27
|
end
|
28
|
-
msg('Dockerfile') do
|
29
|
-
puts "INFOdation Automation created Dockerfile\n"
|
30
|
-
end
|
31
|
-
msg('docker-compose.yml') do
|
32
|
-
puts "INFOdation Automation created Dockerfile\n"
|
33
|
-
end
|
34
28
|
msg('Info') do
|
35
29
|
puts "All Config files created. \n"
|
36
30
|
end
|
data/bin/helper.rb
CHANGED
File without changes
|
data/lib/Ifd_Automation.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,109 @@
|
|
1
|
+
# require 'cucumber_priority'
|
2
|
+
# require 'spreewald_support/tolerance_for_selenium_sync_issues'
|
3
|
+
# require 'spreewald_support/step_fallback'
|
4
|
+
# require_relative '../helper/web_steps_helper'
|
5
|
+
|
6
|
+
# Given /I am on the "(.*?)" page/ do |url|
|
7
|
+
# patiently do
|
8
|
+
# execute_openbrowser(url)
|
9
|
+
# end
|
10
|
+
# end.overridable
|
11
|
+
|
12
|
+
# When /I wait for (\d+) seconds/ do |second|
|
13
|
+
# sleep(second.to_i)
|
14
|
+
# end.overridable
|
15
|
+
|
16
|
+
# And /I click on "(.*?)"/ do |object|
|
17
|
+
# patiently do
|
18
|
+
# execute_click(object)
|
19
|
+
# end
|
20
|
+
# end.overridable
|
21
|
+
|
22
|
+
# Then /I double click on "(.*?)"/ do |element|
|
23
|
+
# patiently do
|
24
|
+
# double_click(element)
|
25
|
+
# end
|
26
|
+
# end.overridable
|
27
|
+
|
28
|
+
# And /I set text on "(.*?)" with "(.*?)"/ do |object, text|
|
29
|
+
# patiently do
|
30
|
+
# execute_settext(object, text)
|
31
|
+
# end
|
32
|
+
# end.overridable
|
33
|
+
|
34
|
+
# And /I select option on "(.*?)" with "(.*?)"/ do |object, text|
|
35
|
+
# patiently do
|
36
|
+
# execute_select(object, text)
|
37
|
+
# end
|
38
|
+
# end.overridable
|
39
|
+
|
40
|
+
# Then /I maximize browser window/ do
|
41
|
+
# maximize_browser
|
42
|
+
# end.overridable
|
43
|
+
|
44
|
+
# Then /I capture a screenshot as "(.*)"/ do |name|
|
45
|
+
# file_path = $test_data_dir + name.downcase
|
46
|
+
# page.save_screenshot(file_path)
|
47
|
+
# end.overridable
|
48
|
+
|
49
|
+
# Then /I switch to window having title "(.*?)"/ do |window_title|
|
50
|
+
# switch_to_window_by_title window_title
|
51
|
+
# end.overridable
|
52
|
+
|
53
|
+
# Then /I scroll to (top|end) of page/ do |to|
|
54
|
+
# scroll_page(to)
|
55
|
+
# end.overridable
|
56
|
+
|
57
|
+
# Then /I check property "(.*?)" with "(.*?)" has( | not)? value "(.*?)"/ do |object, property, negate, value|
|
58
|
+
# value = Utils.bind_with_dyn_vars value
|
59
|
+
# patiently do
|
60
|
+
# execute_checkproperty(object, property, negate, value)
|
61
|
+
# end
|
62
|
+
# end.overridable
|
63
|
+
|
64
|
+
# Then /I should see text alert "(.*?)"/ do |actual_value|
|
65
|
+
# verify_alert_text(actual_value)
|
66
|
+
# end.overridable
|
67
|
+
|
68
|
+
# Given /I move mouse to element "(.*)" and click/ do |object|
|
69
|
+
# patiently do
|
70
|
+
# execute_mousehoverandclick(object)
|
71
|
+
# end
|
72
|
+
# end.overridable
|
73
|
+
|
74
|
+
# And /I remove attribute "(.*)" on object "(.*)"/ do |attr, object|
|
75
|
+
# patiently do
|
76
|
+
# remove_element_attribute object, attr
|
77
|
+
# end
|
78
|
+
# end.overridable
|
79
|
+
|
80
|
+
# And /I set state on "(.*?)" with "(.*?)"/ do |object, state|
|
81
|
+
# patiently do
|
82
|
+
# execute_setstate(object, state)
|
83
|
+
# end
|
84
|
+
# end.overridable
|
85
|
+
|
86
|
+
# And /browser window is re-sized to width "(.*)" and height "(.*)"/ do |x,y|
|
87
|
+
# resize_window_screen(x,y)
|
88
|
+
# end.overridable
|
89
|
+
|
90
|
+
# And /I verify object "(.*)" with "(.*)" has value "(.*)"/ do |object,style,expected_value|
|
91
|
+
# actual_value = get_computed_style(object,style)
|
92
|
+
# patiently do
|
93
|
+
# IFD_Assertion.assert_string_equal(expected_value,actual_value)
|
94
|
+
# end
|
95
|
+
# end.overridable
|
96
|
+
|
97
|
+
# Then /I should( not)? see page title "(.*)"/ do |present, title|
|
98
|
+
# check_title(title, present.empty?)
|
99
|
+
# end.overridable
|
100
|
+
|
101
|
+
# And /I move mouse to element "(.*)" and choose item "(.*)" then click/ do |var, element|
|
102
|
+
# patiently do
|
103
|
+
# movemouseandclick(var, element)
|
104
|
+
# end
|
105
|
+
# end.overridable
|
106
|
+
|
107
|
+
# And /I hold element "(.*)" and move from location x "(.*)" to y "(.*)"$/ do |el, x, y|
|
108
|
+
# drag_drop el, x, y
|
109
|
+
# end.overridable
|
File without changes
|
data/lib/helper/auto_util.rb
CHANGED
File without changes
|
File without changes
|
data/lib/helper/file_helper.rb
CHANGED
File without changes
|
data/lib/helper/mail_helper.rb
CHANGED
File without changes
|
data/lib/helper/rest_helper.rb
CHANGED
File without changes
|
data/lib/helper/soap_helper.rb
CHANGED
File without changes
|
data/lib/helper/ssh_helper.rb
CHANGED
@@ -0,0 +1,72 @@
|
|
1
|
+
module ToleranceForSeleniumSyncIssues
|
2
|
+
RETRY_ERRORS = %w[
|
3
|
+
Capybara::ElementNotFound
|
4
|
+
Spec::Expectations::ExpectationNotMetError
|
5
|
+
RSpec::Expectations::ExpectationNotMetError
|
6
|
+
Minitest::Assertion
|
7
|
+
Capybara::Poltergeist::ClickFailed
|
8
|
+
Capybara::ExpectationNotMet
|
9
|
+
Selenium::WebDriver::Error::StaleElementReferenceError
|
10
|
+
Selenium::WebDriver::Error::NoAlertPresentError
|
11
|
+
Selenium::WebDriver::Error::ElementNotVisibleError
|
12
|
+
Selenium::WebDriver::Error::NoSuchFrameError
|
13
|
+
Selenium::WebDriver::Error::NoAlertPresentError
|
14
|
+
Selenium::WebDriver::Error::JavascriptError
|
15
|
+
Selenium::WebDriver::Error::UnknownError
|
16
|
+
Selenium::WebDriver::Error::NoSuchAlertError
|
17
|
+
]
|
18
|
+
|
19
|
+
class CapybaraWrapper
|
20
|
+
def self.default_max_wait_time
|
21
|
+
if Capybara.respond_to?(:default_max_wait_time)
|
22
|
+
Capybara.default_max_wait_time
|
23
|
+
else
|
24
|
+
Capybara.default_wait_time
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.default_max_wait_time=(value)
|
29
|
+
if Capybara.respond_to?(:default_max_wait_time=)
|
30
|
+
Capybara.default_max_wait_time = value
|
31
|
+
else
|
32
|
+
Capybara.default_wait_time = value
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Patiently
|
38
|
+
WAIT_PERIOD = 0.05
|
39
|
+
|
40
|
+
def patiently(seconds, &block)
|
41
|
+
started = Time.now
|
42
|
+
tries = 0
|
43
|
+
begin
|
44
|
+
tries += 1
|
45
|
+
block.call
|
46
|
+
rescue Exception => e
|
47
|
+
raise e unless retryable_error?(e)
|
48
|
+
raise e if (Time.now - started > seconds && tries >= 2)
|
49
|
+
sleep(WAIT_PERIOD)
|
50
|
+
raise Capybara::FrozenInTime, "time appears to be frozen, Capybara does not work with libraries which freeze time, consider using time travelling instead" if Time.now == started
|
51
|
+
retry
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def retryable_error?(e)
|
58
|
+
RETRY_ERRORS.include?(e.class.name)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
|
63
|
+
def patiently(seconds = CapybaraWrapper.default_max_wait_time, &block)
|
64
|
+
if page.driver.wait?
|
65
|
+
Patiently.new.patiently(seconds, &block)
|
66
|
+
else
|
67
|
+
block.call
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
World(ToleranceForSeleniumSyncIssues)
|
@@ -1,436 +1,616 @@
|
|
1
1
|
require 'net/https'
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
8
|
-
rescue StandardError => myStandardError
|
9
|
-
raise "\n>>> Error: #{myStandardError}"
|
2
|
+
require 'rspec'
|
3
|
+
def execute_openbrowser(url_site)
|
4
|
+
begin
|
5
|
+
if $_CFWEB['Maximize Browser'] == true
|
6
|
+
page.driver.browser.manage.window.maximize
|
10
7
|
end
|
8
|
+
rescue StandardError => e
|
9
|
+
raise "\n>>> Error: #{e}"
|
10
|
+
exit
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
if url_site == ""
|
14
|
+
raise "\n>>> Error: Null web page URL."
|
15
|
+
exit
|
16
|
+
else
|
17
|
+
visit(url_site)
|
17
18
|
end
|
19
|
+
end
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end while (foundElement.native.enabled? == false and (currentTime - startTime) < $_CFWEB['Wait Time'])
|
28
|
-
page.driver.browser.execute_script("arguments[0].scrollIntoView(true);", foundElement.native)
|
29
|
-
page.driver.browser.action.move_to(foundElement.native, element).click.perform
|
30
|
-
# page.driver.browser.action.click(foundElement.native)
|
31
|
-
# foundElement.native.send_keys(:return)
|
32
|
-
else
|
33
|
-
raise "\nError >> Not found object: #{element}"
|
21
|
+
def execute_click(element)
|
22
|
+
foundElement = find_object(element)
|
23
|
+
if foundElement != nil
|
24
|
+
begin
|
25
|
+
foundElement.click
|
26
|
+
rescue StandardError => e
|
27
|
+
raise "\n>>> Error: #{e}"
|
28
|
+
exit
|
34
29
|
end
|
30
|
+
else
|
31
|
+
raise "\nError >> Not found object: #{element}"
|
32
|
+
exit
|
35
33
|
end
|
34
|
+
end
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
else
|
46
|
-
raise "\nError >> Not found object: #{element}"
|
36
|
+
def execute_click_offset(element, x, y)
|
37
|
+
foundElement = find_object(element)
|
38
|
+
if foundElement != nil
|
39
|
+
begin
|
40
|
+
page.driver.browser.mouse.move_to(foundElement.native,x.to_i,y.to_i)
|
41
|
+
page.driver.browser.mouse.click()
|
42
|
+
rescue Exception => e
|
43
|
+
raise "\n>>> Error: #{e}"
|
47
44
|
exit
|
48
45
|
end
|
46
|
+
else
|
47
|
+
raise "\nError >> Not found object: #{element}"
|
48
|
+
exit
|
49
49
|
end
|
50
|
+
end
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
59
|
-
else
|
60
|
-
raise "\nError >> Not found object: #{element}"
|
52
|
+
def double_click(element)
|
53
|
+
foundElement = find_object(element)
|
54
|
+
if foundElement != nil
|
55
|
+
begin
|
56
|
+
foundElement.double_click
|
57
|
+
rescue StandardError => e
|
58
|
+
raise "\n>>> Error: #{e}"
|
61
59
|
exit
|
62
60
|
end
|
61
|
+
else
|
62
|
+
raise "\nError >> Not found object: #{element}"
|
63
|
+
exit
|
63
64
|
end
|
65
|
+
end
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
+
def execute_settext(element, text)
|
68
|
+
foundElement = find_object(element)
|
69
|
+
if foundElement != nil
|
70
|
+
begin
|
71
|
+
foundElement.set(text)
|
72
|
+
rescue StandardError => e
|
73
|
+
raise "\n>>> Error: #{e}"
|
74
|
+
end
|
75
|
+
else
|
76
|
+
raise "\nError >> Not found object: #{element}"
|
77
|
+
exit
|
67
78
|
end
|
79
|
+
end
|
68
80
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
window_found = true
|
76
|
-
break
|
77
|
-
end
|
78
|
-
}
|
79
|
-
raise "Window having title \"#{window_title}\" not found" if not window_found
|
81
|
+
def maximize_browser
|
82
|
+
begin
|
83
|
+
page.driver.browser.manage.window.maximize
|
84
|
+
rescue StandardError => e
|
85
|
+
raise "\n>>> Error: #{e}"
|
86
|
+
exit
|
80
87
|
end
|
88
|
+
end
|
81
89
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
90
|
+
def switch_to_window_by_title(window_title)
|
91
|
+
$previous_window = page.driver.browser.window_handle
|
92
|
+
@window_found = false
|
93
|
+
page.driver.browser.window_handles.each { |handle|
|
94
|
+
page.driver.browser.switch_to.window handle
|
95
|
+
if page.title == window_title
|
96
|
+
@window_found = true
|
97
|
+
break
|
89
98
|
end
|
99
|
+
}
|
100
|
+
if @window_found == false
|
101
|
+
raise "Window having title \"#{window_title}\" not found"
|
102
|
+
exit
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def scroll_to_end_page
|
107
|
+
begin
|
108
|
+
page.driver.execute_script('window.scrollTo(0,Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight));')
|
109
|
+
rescue StandardError => e
|
110
|
+
raise "\n>>> Error: #{e}"
|
111
|
+
exit
|
90
112
|
end
|
113
|
+
end
|
91
114
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
115
|
+
def scroll_to_top_page
|
116
|
+
begin
|
117
|
+
page.driver.execute_script('window.scrollTo(Math.max(document.documentElement.scrollHeight,document.body.scrollHeight,document.documentElement.clientHeight),0);')
|
118
|
+
rescue StandardError => e
|
119
|
+
raise "\n>>> Error: #{e}"
|
120
|
+
exit
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def verify_title(expected_title)
|
125
|
+
begin
|
96
126
|
page_title = page.title
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
if page_title == "#{title}"
|
103
|
-
raise "Page Title Matched, Actual Page Title: #{page_title}"
|
104
|
-
end
|
105
|
-
end
|
127
|
+
puts "Actual Page Title : #{page_title}, Expected Page Title : #{expected_title}"
|
128
|
+
expect(page_title).to eq expected_title
|
129
|
+
rescue StandardError => e
|
130
|
+
raise "\n>>> Error: #{e}"
|
131
|
+
exit
|
106
132
|
end
|
133
|
+
end
|
107
134
|
|
108
|
-
|
135
|
+
def verify_alert_text(text)
|
136
|
+
begin
|
109
137
|
alert = page.driver.browser.switch_to.alert.text
|
110
|
-
|
111
|
-
|
138
|
+
puts "Actual Page alert text : #{alert}, Expected value : #{text}"
|
139
|
+
expect(alert).to eq text
|
140
|
+
rescue StandardError => e
|
141
|
+
raise "\n>>> Error: #{e}"
|
142
|
+
exit
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def accept_alert
|
147
|
+
begin
|
148
|
+
page.driver.browser.switch_to.alert.accept
|
149
|
+
rescue Exception => e
|
150
|
+
raise "\n>>> ERROR: #{e}"
|
151
|
+
exit
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def back
|
156
|
+
begin
|
157
|
+
page.execute_script('window.history.back()')
|
158
|
+
rescue Exception => e
|
159
|
+
raise "\n>>> ERROR: #{e}"
|
160
|
+
exit
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
def refresh
|
165
|
+
begin
|
166
|
+
page.execute_script('window.location.reload()')
|
167
|
+
rescue Exception => e
|
168
|
+
raise "\n>>> ERROR: #{e}"
|
169
|
+
exit
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
def clear_text(element)
|
174
|
+
foundElement = find_object(element)
|
175
|
+
if foundElement != nil?
|
176
|
+
begin
|
177
|
+
foundElement.native.clear
|
178
|
+
rescue Exception => e
|
179
|
+
raise "\n>>> ERROR: #{e}"
|
180
|
+
exit
|
112
181
|
end
|
182
|
+
else
|
183
|
+
raise "\nError >> Not found object: #{element}"
|
184
|
+
exit
|
113
185
|
end
|
186
|
+
end
|
114
187
|
|
115
|
-
|
116
|
-
|
117
|
-
|
188
|
+
def execute_javascript(script)
|
189
|
+
begin
|
190
|
+
page.execute_script(script)
|
191
|
+
rescue Exception => e
|
192
|
+
raise "\nError >> Not found object: #{element}"
|
193
|
+
exit
|
194
|
+
end
|
195
|
+
end
|
118
196
|
|
119
|
-
|
197
|
+
def execute_select(element, text)
|
198
|
+
#select(text, :xpath => element)
|
199
|
+
foundElement = find_object(element)
|
200
|
+
if foundElement != nil
|
201
|
+
begin
|
120
202
|
option_value = page.evaluate_script("$(\"##{foundElement[:id]} option:contains('#{text}')\").val()")
|
121
203
|
page.execute_script("$('##{foundElement[:id]}').val('#{option_value}')")
|
122
204
|
page.execute_script("$('##{foundElement[:id]}').trigger('liszt:updated').trigger('change')")
|
123
|
-
|
124
|
-
|
205
|
+
rescue Exception => e
|
206
|
+
raise "\n>>> ERROR: #{e}"
|
125
207
|
exit
|
126
208
|
end
|
209
|
+
else
|
210
|
+
raise "\nError >> Not found object: #{element}"
|
211
|
+
exit
|
127
212
|
end
|
213
|
+
end
|
128
214
|
|
129
|
-
|
130
|
-
|
131
|
-
|
215
|
+
def execute_mouse_over(element)
|
216
|
+
foundElement = find_object(element)
|
217
|
+
if foundElement != nil
|
218
|
+
begin
|
132
219
|
page.driver.browser.action.move_to(foundElement.native, element).click.perform
|
133
220
|
sleep(1)
|
134
|
-
|
135
|
-
|
221
|
+
rescue StandardError => e
|
222
|
+
raise "\n>>> Error: #{e}"
|
223
|
+
exit
|
136
224
|
end
|
225
|
+
else
|
226
|
+
raise "\nError >> Not found object: #{element}"
|
227
|
+
exit
|
137
228
|
end
|
229
|
+
end
|
138
230
|
|
139
|
-
|
140
|
-
|
141
|
-
|
231
|
+
def remove_element_attribute(element, attr)
|
232
|
+
foundElement = find_object(element)
|
233
|
+
if foundElement != nil
|
234
|
+
begin
|
142
235
|
page.driver.browser.execute_script("arguments[0].removeAttribute('#{attr}');", foundElement.native)
|
143
|
-
|
144
|
-
|
236
|
+
sleep(1)
|
237
|
+
rescue StandardError => e
|
238
|
+
raise "\n>>> Error: #{e}"
|
239
|
+
exit
|
145
240
|
end
|
241
|
+
else
|
242
|
+
raise "\nError >> Not found object: #{element}"
|
243
|
+
exit
|
146
244
|
end
|
245
|
+
end
|
147
246
|
|
148
247
|
# Set state
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
else
|
155
|
-
foundElement.unselect_option
|
156
|
-
end
|
248
|
+
def execute_setstate(element, state)
|
249
|
+
foundElement = find_object(element)
|
250
|
+
if foundElement != nil
|
251
|
+
if state
|
252
|
+
foundElement.select_option
|
157
253
|
else
|
158
|
-
|
159
|
-
exit
|
254
|
+
foundElement.unselect_option
|
160
255
|
end
|
256
|
+
else
|
257
|
+
raise "\nError >> Not found object: #{element}"
|
258
|
+
exit
|
161
259
|
end
|
260
|
+
end
|
261
|
+
|
262
|
+
def close_windows
|
263
|
+
begin
|
264
|
+
page.execute_script "window.close();"
|
265
|
+
rescue StandardError => e
|
266
|
+
raise "\n>>> Error: #{e}"
|
267
|
+
exit
|
268
|
+
end
|
269
|
+
end
|
162
270
|
|
163
|
-
|
271
|
+
def resize_window_screen(x, y)
|
272
|
+
begin
|
164
273
|
page.driver.browser.manage.window.resize_to(x, y)
|
165
274
|
puts page.driver.browser.manage.window.size
|
275
|
+
rescue StandardError => e
|
276
|
+
raise "\n>>> Error: #{e}"
|
277
|
+
exit
|
166
278
|
end
|
279
|
+
end
|
167
280
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
)
|
175
|
-
else
|
176
|
-
puts "\nError >> Not found object: #{element}"
|
177
|
-
end
|
178
|
-
puts "\nActual object style value is: #{computedStyle}"
|
179
|
-
computedStyle
|
281
|
+
def switch_to_frame(element)
|
282
|
+
begin
|
283
|
+
page.driver.browser.switch_to.frame 'element'
|
284
|
+
rescue Exception => e
|
285
|
+
raise "\n>>> Error: #{e}"
|
286
|
+
exit
|
180
287
|
end
|
288
|
+
end
|
181
289
|
|
182
|
-
|
290
|
+
def get_computed_style(element, style)
|
291
|
+
foundElement = get_object_value(element)
|
292
|
+
computedStyle = ""
|
293
|
+
if foundElement != nil
|
294
|
+
computedStyle = page.evaluate_script("window.getComputedStyle(document.querySelector('#{foundElement}')).#{style}")
|
295
|
+
else
|
296
|
+
raise "\nError >> Not found object: #{element}"
|
297
|
+
exit
|
298
|
+
end
|
299
|
+
puts "\nActual object style value is: #{computedStyle}"
|
300
|
+
computedStyle
|
301
|
+
end
|
183
302
|
|
184
|
-
|
185
|
-
|
303
|
+
def put_log str
|
304
|
+
p str if $_CFWEB['Print Log'] == true
|
305
|
+
end
|
306
|
+
|
307
|
+
def get_object_value(str_obj)
|
308
|
+
string_object = str_obj.gsub(/"/, "'")
|
309
|
+
hash_object = $OBJECT[string_object]
|
310
|
+
if hash_object == nil
|
311
|
+
raise ">>> OBJECT: #{str_obj} NAME MAYBE NOT FOUND!!!"
|
312
|
+
exit
|
186
313
|
end
|
314
|
+
if hash_object.keys[0].to_s.upcase != "CSS_SELECTOR"
|
315
|
+
raise ">>> OBJECT: #{str_obj} should be formatted as Css Selector."
|
316
|
+
exit
|
317
|
+
end
|
318
|
+
hash_object[hash_object.keys[0]]
|
319
|
+
end
|
187
320
|
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
raise ">>>
|
321
|
+
def get_element_text(element)
|
322
|
+
foundElement = find_object(element)
|
323
|
+
if foundElement != nil
|
324
|
+
begin
|
325
|
+
result = foundElement.text()
|
326
|
+
puts "Text of #{element}: #{result}"
|
327
|
+
rescue StandardError => e
|
328
|
+
raise "\n>>> Error: #{e}"
|
329
|
+
exit
|
196
330
|
end
|
197
|
-
|
331
|
+
else
|
332
|
+
raise "\nError >> Not found object: #{element}"
|
333
|
+
exit
|
198
334
|
end
|
335
|
+
end
|
199
336
|
|
200
|
-
|
201
|
-
|
202
|
-
|
337
|
+
def get_element_attribute(element,value)
|
338
|
+
foundElement = find_object(element)
|
339
|
+
if foundElement != nil
|
340
|
+
begin
|
341
|
+
result = foundElement.value()
|
342
|
+
puts "Attribute of #{element}: #{result}"
|
343
|
+
rescue StandardError => e
|
344
|
+
raise "\n>>> Error: #{e}"
|
345
|
+
exit
|
203
346
|
end
|
204
|
-
|
347
|
+
else
|
348
|
+
raise "\nError >> Not found object: #{element}"
|
349
|
+
exit
|
350
|
+
end
|
351
|
+
end
|
205
352
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
353
|
+
def verify_element_text(element,value)
|
354
|
+
foundElement = find_object(element)
|
355
|
+
if foundElement != nil
|
356
|
+
begin
|
357
|
+
actual_value = foundElement.text()
|
358
|
+
put_log "Actual result is: '#{actual_value}' -- Expected result is: '#{value}'"
|
359
|
+
expect(actual_value).to eq value
|
360
|
+
rescue Exception => e
|
361
|
+
raise "\n>>> ERROR: #{e} "
|
362
|
+
exit
|
363
|
+
end
|
364
|
+
else
|
365
|
+
raise "\nError >> Not found object: #{element}"
|
366
|
+
exit
|
367
|
+
end
|
368
|
+
end
|
216
369
|
|
217
|
-
|
218
|
-
|
370
|
+
def verify_element_not_has_text(element,value)
|
371
|
+
foundElement = find_object(element)
|
372
|
+
if foundElement != nil
|
373
|
+
begin
|
374
|
+
actual_value = foundElement.text()
|
375
|
+
put_log "Actual result is: '#{actual_value}' -- Expected result is: '#{value}'"
|
376
|
+
expect(actual_value).not_to eql value
|
377
|
+
rescue Exception => e
|
378
|
+
raise "\n>>> ERROR: #{e}"
|
379
|
+
exit
|
380
|
+
end
|
219
381
|
|
220
|
-
|
221
|
-
|
222
|
-
|
382
|
+
else
|
383
|
+
raise "\nError >> Not found object: #{element}"
|
384
|
+
exit
|
385
|
+
end
|
386
|
+
end
|
223
387
|
|
224
|
-
|
225
|
-
|
388
|
+
def verify_element_value(element,value)
|
389
|
+
foundElement = find_object(element)
|
390
|
+
if foundElement != nil
|
391
|
+
begin
|
392
|
+
actual_value = foundElement.value()
|
393
|
+
put_log "Actual result is: '#{actual_value}' -- Expected result is: '#{value}'"
|
394
|
+
expect(actual_value).to eq value
|
395
|
+
rescue Exception => e
|
396
|
+
raise "\n>>> ERROR: #{e}"
|
397
|
+
exit
|
398
|
+
end
|
399
|
+
else
|
400
|
+
raise "\nError >> Not found object: #{element}"
|
401
|
+
exit
|
402
|
+
end
|
403
|
+
end
|
226
404
|
|
227
|
-
|
228
|
-
|
405
|
+
def verify_element_not_has_value(element,value)
|
406
|
+
foundElement = find_object(element)
|
407
|
+
if foundElement != nil
|
408
|
+
begin
|
409
|
+
actual_value = foundElement.value()
|
410
|
+
put_log "Actual result is: '#{actual_value}' -- Expected result is: '#{value}'"
|
411
|
+
expect(actual_value).not_to eql value
|
412
|
+
rescue Exception => e
|
413
|
+
raise "\n>>> ERROR: #{e}"
|
414
|
+
exit
|
415
|
+
end
|
416
|
+
else
|
417
|
+
raise "\nError >> Not found object: #{element}"
|
418
|
+
exit
|
419
|
+
end
|
420
|
+
end
|
229
421
|
|
230
|
-
|
231
|
-
|
422
|
+
def execute_checkproperty(element, property, negate, value, isSpecialChar=false)
|
423
|
+
validate_option_by(property)
|
424
|
+
Capybara.configure do |config|
|
425
|
+
config.ignore_hidden_elements = false
|
426
|
+
end
|
427
|
+
foundElement = find_object(element)
|
428
|
+
|
429
|
+
check = false
|
430
|
+
if foundElement == nil and value == ""
|
431
|
+
check = true
|
432
|
+
# check.should eq true
|
433
|
+
expect(check).to eq true
|
434
|
+
else
|
435
|
+
# put_log "\n\n\t>>> execute_checkproperty: finish to found element"
|
436
|
+
if foundElement != nil
|
232
437
|
|
233
|
-
|
234
|
-
|
438
|
+
if property.upcase == 'VALUE'
|
439
|
+
actual_value = foundElement.value()
|
235
440
|
|
236
|
-
|
237
|
-
|
441
|
+
elsif property.upcase == 'TEXT'
|
442
|
+
actual_value = foundElement.text()
|
238
443
|
|
239
|
-
|
240
|
-
|
444
|
+
else
|
445
|
+
actual_value = foundElement["#{property}"]
|
446
|
+
end
|
241
447
|
|
242
|
-
|
243
|
-
|
448
|
+
if actual_value == nil
|
449
|
+
actual_value = ''
|
450
|
+
end
|
451
|
+
else
|
452
|
+
put_log "\nError >> Not found object: #{element}"
|
453
|
+
end
|
244
454
|
|
245
|
-
|
246
|
-
|
455
|
+
Capybara.configure do |config|
|
456
|
+
config.ignore_hidden_elements = true
|
457
|
+
end
|
247
458
|
|
248
|
-
|
249
|
-
|
459
|
+
# if IFD_Assertion.reg_compare(actual_value, value, isSpecialChar)
|
460
|
+
# check = true
|
461
|
+
# end
|
250
462
|
|
251
|
-
|
252
|
-
actual_value = foundElement[:title]
|
463
|
+
put_log "\n#{property} :: Actual result is: '#{actual_value}' -- Expected result is: '#{value}'"
|
253
464
|
|
254
|
-
|
255
|
-
|
465
|
+
if negate == " not"
|
466
|
+
actual_value.should_not eq value
|
467
|
+
expect(actual_value).not_to eql value
|
468
|
+
elsif actual_value.should eq value
|
469
|
+
expect(actual_value).to eq value
|
470
|
+
end
|
471
|
+
end
|
472
|
+
end
|
256
473
|
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
else
|
261
|
-
actual_value = foundElement["#{property}"]
|
262
|
-
end
|
474
|
+
def check_valid_option_by?(option_by)
|
475
|
+
%w(text value).include? option_by
|
476
|
+
end
|
263
477
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
else
|
268
|
-
put_log "\nError >> Not found object: #{element}"
|
269
|
-
end
|
478
|
+
def validate_option_by(option_by)
|
479
|
+
raise "Please select valid option, invalid option - #{option_by}" unless check_valid_option_by? option_by
|
480
|
+
end
|
270
481
|
|
271
|
-
|
272
|
-
|
273
|
-
|
482
|
+
def check_valid_keys?(key)
|
483
|
+
%w(:cancel :help :backspace :tab :clear :return :enter :shift :control :alt :pause :escape :space :page_up :page_down :end :home :left :up :right :down :insert :delete :semicolon :equals).include? key
|
484
|
+
end
|
274
485
|
|
275
|
-
|
276
|
-
|
277
|
-
|
486
|
+
def validate_supported_keys(key)
|
487
|
+
raise "Please select valid keys, invalid key - #{key}" unless check_valid_option_by? key
|
488
|
+
end
|
278
489
|
|
279
|
-
put_log "\n#{property} :: Actual result is: '#{actual_value}' -- Expected result is: '#{value}'"
|
280
490
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
491
|
+
def find_object(string_object)
|
492
|
+
startTime = Time.new.to_i
|
493
|
+
string_object = string_object.gsub(/"/, "'")
|
494
|
+
locator_matching = /(.*?)(\{.*?\})/.match(string_object)
|
495
|
+
dyn_pros = {}
|
496
|
+
if locator_matching != nil
|
497
|
+
string_object = locator_matching[1]
|
498
|
+
eval(locator_matching[2].gsub(/['][\s,\t]*?:[\s,\t]*?[']?/, "'=>'")).each { |k, v|
|
499
|
+
dyn_pros[k.to_s.upcase] = v
|
500
|
+
}
|
288
501
|
end
|
289
502
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
503
|
+
hash_object = $OBJECT[string_object]
|
504
|
+
if hash_object == nil
|
505
|
+
raise "ERROR: >>> Object: #{string_object} is not found in Object Repository."
|
506
|
+
end
|
507
|
+
upcase_attrb = {}
|
508
|
+
if hash_object != nil
|
509
|
+
hash_object.each { |k, v|
|
510
|
+
k = k.to_s.upcase
|
511
|
+
if k =~ /ph_/i
|
512
|
+
if dyn_pros[k] != nil
|
513
|
+
if v =~ /<ph_value>/i
|
514
|
+
upcase_attrb[k[3..k.size-1]] = v.gsub(/<ph_value>/i, dyn_pros[k])
|
515
|
+
else
|
516
|
+
upcase_attrb[k[3..k.size-1]] = dyn_pros[k]
|
517
|
+
end
|
294
518
|
|
295
|
-
|
296
|
-
else
|
297
|
-
actual_text = foundElement.text()
|
298
|
-
if (actual_text == nil or actual_text.length == 0) and (tagname.upcase == 'INPUT' or tagname.upcase == 'TEXTAREA')
|
299
|
-
actual_text = foundElement.value()
|
519
|
+
dyn_pros.delete(k)
|
300
520
|
end
|
521
|
+
else
|
522
|
+
upcase_attrb[k.to_s.upcase] = v
|
301
523
|
end
|
302
524
|
|
303
|
-
|
304
|
-
|
525
|
+
}
|
526
|
+
end
|
527
|
+
ph_attrs = {}
|
528
|
+
dyn_pros.each { |k, v|
|
529
|
+
if k =~ /ph_/i
|
530
|
+
ph_attrs[k] = v
|
305
531
|
else
|
306
|
-
|
307
|
-
exit
|
532
|
+
upcase_attrb[k.to_s.upcase] = v
|
308
533
|
end
|
309
|
-
|
534
|
+
}
|
310
535
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
locator_matching = /(.*?)(\{.*?\})/.match(string_object)
|
315
|
-
dyn_pros = {}
|
316
|
-
if locator_matching != nil
|
317
|
-
string_object = locator_matching[1]
|
318
|
-
eval(locator_matching[2].gsub(/['][\s,\t]*?:[\s,\t]*?[']?/, "'=>'")).each { |k, v|
|
319
|
-
dyn_pros[k.to_s.upcase] = v
|
320
|
-
}
|
321
|
-
end
|
536
|
+
if upcase_attrb.size > 0
|
537
|
+
strCssSelector = ""
|
538
|
+
strXpathSelector = ""
|
322
539
|
|
323
|
-
hash_object = $OBJECT[string_object]
|
324
|
-
if hash_object == nil
|
325
|
-
raise "ERROR: >>> Object: #{string_object} is not found in Object Repository."
|
326
|
-
end
|
327
|
-
upcase_attrb = {}
|
328
|
-
if hash_object != nil
|
329
|
-
hash_object.each { |k, v|
|
330
|
-
k = k.to_s.upcase
|
331
|
-
if k =~ /ph_/i
|
332
|
-
if dyn_pros[k] != nil
|
333
|
-
if v =~ /<ph_value>/i
|
334
|
-
upcase_attrb[k[3..k.size-1]] = v.gsub(/<ph_value>/i, dyn_pros[k])
|
335
|
-
else
|
336
|
-
upcase_attrb[k[3..k.size-1]] = dyn_pros[k]
|
337
|
-
end
|
338
|
-
|
339
|
-
dyn_pros.delete(k)
|
340
|
-
end
|
341
|
-
else
|
342
|
-
upcase_attrb[k.to_s.upcase] = v
|
343
|
-
end
|
344
540
|
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
541
|
+
upcase_attrb.each { |key, value|
|
542
|
+
upcase_key = key.to_s.upcase
|
543
|
+
case upcase_key
|
544
|
+
when "XPATH_SELECTOR"
|
545
|
+
strXpathSelector = value
|
546
|
+
when "CSS_SELECTOR"
|
547
|
+
strCssSelector = value
|
351
548
|
else
|
352
|
-
|
549
|
+
raise "ERROR: >>> Wrong format type: #{key.to_s} of object: #{string_object}. Available supported format are: XPATH_SELECTOR and CSS_SELECTOR"
|
353
550
|
end
|
354
551
|
}
|
355
552
|
|
356
|
-
|
357
|
-
strCssSelector
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
if foundElements == nil or foundElements.length == 0
|
380
|
-
currentTime = Time.new.to_i
|
381
|
-
else
|
382
|
-
put_log "\nBREAK!!!"
|
553
|
+
begin
|
554
|
+
if strCssSelector != nil and strCssSelector.length > 0
|
555
|
+
foundElements = get_objects_by_css_selector(strCssSelector)
|
556
|
+
else
|
557
|
+
foundElements = get_objects_by_xpath_selector(strXpathSelector)
|
558
|
+
end
|
559
|
+
if foundElements == nil or foundElements.length == 0
|
560
|
+
currentTime = Time.new.to_i
|
561
|
+
else
|
562
|
+
# put_log "\nBREAK!!!"
|
563
|
+
break
|
564
|
+
end
|
565
|
+
test = currentTime - startTime
|
566
|
+
# put_log "\n#TIMEOUNT:#{test} < #{$_CFWEB['Wait Time']}"
|
567
|
+
sleep(0.5)
|
568
|
+
end while (currentTime - startTime) < $_CFWEB['Wait Time']
|
569
|
+
|
570
|
+
if foundElements != nil or foundElements.length != 0
|
571
|
+
return_element = nil
|
572
|
+
foundElements.each { |cur_element|
|
573
|
+
passCheck = find_object_check_object(cur_element)
|
574
|
+
if passCheck
|
575
|
+
return_element = cur_element
|
383
576
|
break
|
384
577
|
end
|
385
|
-
|
386
|
-
|
387
|
-
sleep(0.5)
|
388
|
-
end while (currentTime - startTime) < $_CFWEB['Wait Time']
|
389
|
-
|
390
|
-
if foundElements != nil or foundElements.length != 0
|
391
|
-
return_element = nil
|
392
|
-
foundElements.each { |cur_element|
|
393
|
-
passCheck = find_object_check_object(cur_element)
|
394
|
-
if passCheck
|
395
|
-
return_element = cur_element
|
396
|
-
break
|
397
|
-
end
|
398
|
-
}
|
399
|
-
return return_element
|
400
|
-
end
|
578
|
+
}
|
579
|
+
return return_element
|
401
580
|
end
|
402
|
-
|
403
|
-
nil
|
404
581
|
end
|
405
582
|
|
406
|
-
|
407
|
-
|
408
|
-
begin
|
409
|
-
foundElements = page.all(:css, strCssSelector)
|
410
|
-
rescue StandardError => myStandardError
|
411
|
-
raise "\n>>> Error: #{myStandardError}"
|
412
|
-
end
|
583
|
+
nil
|
584
|
+
end
|
413
585
|
|
414
|
-
|
586
|
+
def get_objects_by_css_selector(strCssSelector)
|
587
|
+
foundElements = nil
|
588
|
+
begin
|
589
|
+
foundElements = page.all(:css, strCssSelector)
|
590
|
+
rescue StandardError => e
|
591
|
+
raise "\n>>> Error: #{e}"
|
415
592
|
end
|
593
|
+
foundElements
|
594
|
+
end
|
416
595
|
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
foundElements
|
596
|
+
def get_objects_by_xpath_selector(strXpathSelector)
|
597
|
+
foundElements = nil
|
598
|
+
begin
|
599
|
+
foundElements = page.all(:xpath, strXpathSelector)
|
600
|
+
rescue StandardError => e
|
601
|
+
raise "\n>>> Error: #{e}"
|
602
|
+
exit
|
425
603
|
end
|
604
|
+
foundElements
|
605
|
+
end
|
426
606
|
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
end
|
432
|
-
false
|
607
|
+
def find_object_check_object(cur_element)
|
608
|
+
passCheck = true
|
609
|
+
if cur_element != nil
|
610
|
+
return passCheck
|
433
611
|
end
|
612
|
+
false
|
613
|
+
end
|
434
614
|
|
435
615
|
def get_object_and_store_as_string(object,string)
|
436
616
|
text = execute_gettext(object)
|
@@ -446,9 +626,43 @@ def get_object_and_store_to_file(object,file_name)
|
|
446
626
|
end
|
447
627
|
end
|
448
628
|
|
449
|
-
def
|
450
|
-
foundElement =
|
451
|
-
|
629
|
+
def drag_and_drop_by_offset(element, x, y)
|
630
|
+
foundElement = find_object(element)
|
631
|
+
if foundElement != nil
|
632
|
+
begin
|
633
|
+
page.driver.browser.action.drag_and_drop_by(foundElement, x, y).perform
|
634
|
+
rescue Exception => e
|
635
|
+
raise "\n>>> ERROR: #{e}"
|
636
|
+
exit
|
637
|
+
end
|
638
|
+
else
|
639
|
+
raise "\nError >> Not found object: #{element}"
|
640
|
+
exit
|
641
|
+
end
|
642
|
+
end
|
643
|
+
|
644
|
+
def drag_and_drop_to_object(from_element, element)
|
645
|
+
found_from_element = find_object(from_element)
|
646
|
+
foundElement = find_object(element)
|
647
|
+
if foundElement != nil and found_from_element != nil
|
648
|
+
found_from_element.drag_to(foundElement)
|
649
|
+
end
|
650
|
+
end
|
651
|
+
|
652
|
+
def execute_sendkeys(element, key)
|
653
|
+
validate_supported_keys(key)
|
654
|
+
foundElement = find_object(element)
|
655
|
+
if foundElement != nil
|
656
|
+
begin
|
657
|
+
foundElement.native.send_keys(key)
|
658
|
+
rescue Exception => e
|
659
|
+
raise "\n>>> ERROR: #{e}"
|
660
|
+
exit
|
661
|
+
end
|
662
|
+
else
|
663
|
+
raise "\nError >> Not found object: #{element}"
|
664
|
+
exit
|
665
|
+
end
|
452
666
|
end
|
453
667
|
|
454
668
|
def movemouseandclick var, element
|