@eclipse-che/che-e2e 7.74.0-dev-1d09cb7 → 7.74.0-dev-41d1364

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 (221) hide show
  1. package/.eslintignore +10 -0
  2. package/.eslintrc.js +183 -0
  3. package/.prettierignore +10 -0
  4. package/.prettierrc.json +10 -0
  5. package/README.md +47 -47
  6. package/configs/inversify.config.ts +13 -9
  7. package/configs/inversify.types.ts +29 -29
  8. package/configs/mocharc.ts +21 -24
  9. package/constants/API_TEST_CONSTANTS.ts +67 -0
  10. package/constants/BASE_TEST_CONSTANTS.ts +80 -0
  11. package/constants/CHROME_DRIVER_CONSTANTS.ts +54 -0
  12. package/constants/FACTORY_TEST_CONSTANTS.ts +61 -0
  13. package/constants/MONACO_CONSTANTS.ts +25 -0
  14. package/constants/OAUTH_CONSTANTS.ts +67 -0
  15. package/constants/PLUGIN_TEST_CONSTANTS.ts +15 -0
  16. package/constants/REPORTER_CONSTANTS.ts +53 -0
  17. package/constants/TIMEOUT_CONSTANTS.ts +131 -0
  18. package/dist/configs/inversify.config.js +14 -8
  19. package/dist/configs/inversify.config.js.map +1 -1
  20. package/dist/configs/inversify.types.js +2 -2
  21. package/dist/configs/inversify.types.js.map +1 -1
  22. package/dist/configs/mocharc.js +13 -16
  23. package/dist/configs/mocharc.js.map +1 -1
  24. package/dist/constants/{APITestConstants.js → API_TEST_CONSTANTS.js} +12 -12
  25. package/dist/constants/API_TEST_CONSTANTS.js.map +1 -0
  26. package/dist/constants/{BaseTestConstants.js → BASE_TEST_CONSTANTS.js} +16 -16
  27. package/dist/constants/BASE_TEST_CONSTANTS.js.map +1 -0
  28. package/dist/constants/{ChromeDriverConstants.js → CHROME_DRIVER_CONSTANTS.js} +13 -13
  29. package/dist/constants/CHROME_DRIVER_CONSTANTS.js.map +1 -0
  30. package/dist/constants/{FactoryTestConstants.js → FACTORY_TEST_CONSTANTS.js} +14 -13
  31. package/dist/constants/FACTORY_TEST_CONSTANTS.js.map +1 -0
  32. package/dist/constants/{MonacoConstants.js → MONACO_CONSTANTS.js} +7 -7
  33. package/dist/constants/MONACO_CONSTANTS.js.map +1 -0
  34. package/dist/constants/{OAuthConstants.js → OAUTH_CONSTANTS.js} +14 -14
  35. package/dist/constants/OAUTH_CONSTANTS.js.map +1 -0
  36. package/dist/constants/{PluginsTestConstants.js → PLUGIN_TEST_CONSTANTS.js} +7 -7
  37. package/dist/constants/PLUGIN_TEST_CONSTANTS.js.map +1 -0
  38. package/dist/constants/{ReporterConstants.js → REPORTER_CONSTANTS.js} +12 -12
  39. package/dist/constants/REPORTER_CONSTANTS.js.map +1 -0
  40. package/dist/constants/{TimeoutConstants.js → TIMEOUT_CONSTANTS.js} +24 -24
  41. package/dist/constants/TIMEOUT_CONSTANTS.js.map +1 -0
  42. package/dist/driver/ChromeDriver.js +12 -16
  43. package/dist/driver/ChromeDriver.js.map +1 -1
  44. package/dist/index.js +9 -9
  45. package/dist/index.js.map +1 -1
  46. package/dist/pageobjects/dashboard/CreateWorkspace.js +11 -11
  47. package/dist/pageobjects/dashboard/CreateWorkspace.js.map +1 -1
  48. package/dist/pageobjects/dashboard/Dashboard.js +16 -16
  49. package/dist/pageobjects/dashboard/Dashboard.js.map +1 -1
  50. package/dist/pageobjects/dashboard/Workspaces.js +28 -28
  51. package/dist/pageobjects/dashboard/Workspaces.js.map +1 -1
  52. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js +36 -25
  53. package/dist/pageobjects/dashboard/workspace-details/WorkspaceDetails.js.map +1 -1
  54. package/dist/pageobjects/git-providers/OauthPage.js +20 -18
  55. package/dist/pageobjects/git-providers/OauthPage.js.map +1 -1
  56. package/dist/pageobjects/ide/CheCodeLocatorLoader.js +9 -9
  57. package/dist/pageobjects/ide/CheCodeLocatorLoader.js.map +1 -1
  58. package/dist/pageobjects/login/interfaces/ICheLoginPage.js +2 -2
  59. package/dist/pageobjects/login/interfaces/IOcpLoginPage.js +2 -2
  60. package/dist/pageobjects/login/kubernetes/DexLoginPage.js +5 -5
  61. package/dist/pageobjects/login/kubernetes/DexLoginPage.js.map +1 -1
  62. package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js +5 -5
  63. package/dist/pageobjects/login/kubernetes/KubernetesLoginPage.js.map +1 -1
  64. package/dist/pageobjects/login/openshift/OcpLoginPage.js +13 -13
  65. package/dist/pageobjects/login/openshift/OcpLoginPage.js.map +1 -1
  66. package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js +5 -5
  67. package/dist/pageobjects/login/openshift/OcpRedHatLoginPage.js.map +1 -1
  68. package/dist/pageobjects/login/openshift/OcpUserLoginPage.js +6 -6
  69. package/dist/pageobjects/login/openshift/OcpUserLoginPage.js.map +1 -1
  70. package/dist/pageobjects/login/openshift/RedHatLoginPage.js +5 -5
  71. package/dist/pageobjects/login/openshift/RedHatLoginPage.js.map +1 -1
  72. package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js +8 -8
  73. package/dist/pageobjects/login/openshift/RegularUserOcpCheLoginPage.js.map +1 -1
  74. package/dist/pageobjects/openshift/OcpApplicationPage.js +5 -5
  75. package/dist/pageobjects/openshift/OcpApplicationPage.js.map +1 -1
  76. package/dist/pageobjects/openshift/OcpImportFromGitPage.js +4 -4
  77. package/dist/pageobjects/openshift/OcpImportFromGitPage.js.map +1 -1
  78. package/dist/pageobjects/openshift/OcpMainPage.js +6 -6
  79. package/dist/pageobjects/openshift/OcpMainPage.js.map +1 -1
  80. package/dist/specs/MochaHooks.js +26 -23
  81. package/dist/specs/MochaHooks.js.map +1 -1
  82. package/dist/specs/SmokeTest.spec.js +11 -11
  83. package/dist/specs/SmokeTest.spec.js.map +1 -1
  84. package/dist/specs/api/ContainerOverridesAPI.spec.js +10 -1
  85. package/dist/specs/api/ContainerOverridesAPI.spec.js.map +1 -1
  86. package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js +26 -15
  87. package/dist/specs/api/DevfileAcceptanceTestAPI.spec.js.map +1 -1
  88. package/dist/specs/api/EmptyWorkspaceAPI.spec.js +17 -11
  89. package/dist/specs/api/EmptyWorkspaceAPI.spec.js.map +1 -1
  90. package/dist/specs/api/PodOverridesAPI.spec.js +12 -3
  91. package/dist/specs/api/PodOverridesAPI.spec.js.map +1 -1
  92. package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js +5 -5
  93. package/dist/specs/dashboard-samples/EmptyWorkspace.spec.js.map +1 -1
  94. package/dist/specs/dashboard-samples/Quarkus.spec.js +7 -7
  95. package/dist/specs/dashboard-samples/Quarkus.spec.js.map +1 -1
  96. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js +41 -41
  97. package/dist/specs/dashboard-samples/RecommendedExtensions.spec.js.map +1 -1
  98. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js +14 -9
  99. package/dist/specs/devconsole-intergration/DevConsoleIntegration.spec.js.map +1 -1
  100. package/dist/specs/factory/Factory.spec.js +25 -25
  101. package/dist/specs/factory/Factory.spec.js.map +1 -1
  102. package/dist/specs/factory/NoSetupRepoFactory.spec.js +37 -34
  103. package/dist/specs/factory/NoSetupRepoFactory.spec.js.map +1 -1
  104. package/dist/specs/factory/RefusedOAuthFactory.spec.js +33 -33
  105. package/dist/specs/factory/RefusedOAuthFactory.spec.js.map +1 -1
  106. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js +12 -3
  107. package/dist/specs/miscellaneous/PredefinedNamespace.spec.js.map +1 -1
  108. package/dist/tests-library/LoginTests.js +7 -7
  109. package/dist/tests-library/LoginTests.js.map +1 -1
  110. package/dist/tests-library/ProjectAndFileTests.js +7 -5
  111. package/dist/tests-library/ProjectAndFileTests.js.map +1 -1
  112. package/dist/tests-library/WorkspaceHandlingTests.js +16 -13
  113. package/dist/tests-library/WorkspaceHandlingTests.js.map +1 -1
  114. package/dist/utils/BrowserTabsUtil.js +19 -14
  115. package/dist/utils/BrowserTabsUtil.js.map +1 -1
  116. package/dist/utils/CheReporter.js +44 -44
  117. package/dist/utils/CheReporter.js.map +1 -1
  118. package/dist/utils/DevWorkspaceConfigurationHelper.js +17 -8
  119. package/dist/utils/DevWorkspaceConfigurationHelper.js.map +1 -1
  120. package/dist/utils/DevfilesRegistryHelper.js +19 -13
  121. package/dist/utils/DevfilesRegistryHelper.js.map +1 -1
  122. package/dist/utils/DriverHelper.js +64 -66
  123. package/dist/utils/DriverHelper.js.map +1 -1
  124. package/dist/utils/KubernetesCommandLineToolsExecutor.js +28 -24
  125. package/dist/utils/KubernetesCommandLineToolsExecutor.js.map +1 -1
  126. package/dist/utils/Logger.js +18 -19
  127. package/dist/utils/Logger.js.map +1 -1
  128. package/dist/utils/ScreenCatcher.js +18 -12
  129. package/dist/utils/ScreenCatcher.js.map +1 -1
  130. package/dist/utils/ShellExecutor.js +9 -0
  131. package/dist/utils/ShellExecutor.js.map +1 -1
  132. package/dist/utils/StringUtil.js +15 -7
  133. package/dist/utils/StringUtil.js.map +1 -1
  134. package/dist/utils/request-handlers/CheApiRequestHandler.js +27 -27
  135. package/dist/utils/request-handlers/CheApiRequestHandler.js.map +1 -1
  136. package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js +10 -6
  137. package/dist/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.js.map +1 -1
  138. package/dist/utils/request-handlers/headers/IAuthorizationHeaderHandler.js +2 -2
  139. package/dist/utils/workspace/ApiUrlResolver.js +3 -3
  140. package/dist/utils/workspace/ApiUrlResolver.js.map +1 -1
  141. package/dist/utils/workspace/ITestWorkspaceUtil.js +2 -2
  142. package/dist/utils/workspace/TestWorkspaceUtil.js +21 -19
  143. package/dist/utils/workspace/TestWorkspaceUtil.js.map +1 -1
  144. package/dist/utils/workspace/WorkspaceStatus.js +2 -2
  145. package/dist/utils/workspace/WorkspaceStatus.js.map +1 -1
  146. package/driver/ChromeDriver.ts +44 -50
  147. package/driver/IDriver.ts +3 -3
  148. package/index.ts +9 -9
  149. package/package.json +59 -49
  150. package/pageobjects/dashboard/CreateWorkspace.ts +64 -55
  151. package/pageobjects/dashboard/Dashboard.ts +101 -100
  152. package/pageobjects/dashboard/Workspaces.ts +196 -164
  153. package/pageobjects/dashboard/workspace-details/WorkspaceDetails.ts +150 -125
  154. package/pageobjects/git-providers/OauthPage.ts +177 -166
  155. package/pageobjects/ide/CheCodeLocatorLoader.ts +49 -46
  156. package/pageobjects/login/interfaces/ICheLoginPage.ts +3 -3
  157. package/pageobjects/login/interfaces/IOcpLoginPage.ts +3 -3
  158. package/pageobjects/login/kubernetes/DexLoginPage.ts +31 -30
  159. package/pageobjects/login/kubernetes/KubernetesLoginPage.ts +15 -14
  160. package/pageobjects/login/openshift/OcpLoginPage.ts +61 -54
  161. package/pageobjects/login/openshift/OcpRedHatLoginPage.ts +29 -24
  162. package/pageobjects/login/openshift/OcpUserLoginPage.ts +15 -18
  163. package/pageobjects/login/openshift/RedHatLoginPage.ts +48 -46
  164. package/pageobjects/login/openshift/RegularUserOcpCheLoginPage.ts +38 -34
  165. package/pageobjects/openshift/OcpApplicationPage.ts +21 -20
  166. package/pageobjects/openshift/OcpImportFromGitPage.ts +70 -68
  167. package/pageobjects/openshift/OcpMainPage.ts +69 -68
  168. package/specs/MochaHooks.ts +59 -50
  169. package/specs/SmokeTest.spec.ts +43 -40
  170. package/specs/api/ContainerOverridesAPI.spec.ts +33 -26
  171. package/specs/api/DevfileAcceptanceTestAPI.spec.ts +106 -95
  172. package/specs/api/EmptyWorkspaceAPI.spec.ts +62 -57
  173. package/specs/api/PodOverridesAPI.spec.ts +42 -33
  174. package/specs/dashboard-samples/EmptyWorkspace.spec.ts +31 -31
  175. package/specs/dashboard-samples/Quarkus.spec.ts +34 -34
  176. package/specs/dashboard-samples/RecommendedExtensions.spec.ts +192 -174
  177. package/specs/devconsole-intergration/DevConsoleIntegration.spec.ts +61 -52
  178. package/specs/factory/Factory.spec.ts +178 -168
  179. package/specs/factory/NoSetupRepoFactory.spec.ts +226 -211
  180. package/specs/factory/RefusedOAuthFactory.spec.ts +218 -204
  181. package/specs/miscellaneous/PredefinedNamespace.spec.ts +64 -54
  182. package/tests-library/LoginTests.ts +34 -32
  183. package/tests-library/ProjectAndFileTests.ts +21 -18
  184. package/tests-library/WorkspaceHandlingTests.ts +98 -89
  185. package/tsconfig.json +15 -15
  186. package/utils/BrowserTabsUtil.ts +103 -97
  187. package/utils/CheReporter.ts +141 -145
  188. package/utils/DevWorkspaceConfigurationHelper.ts +70 -61
  189. package/utils/DevfilesRegistryHelper.ts +67 -58
  190. package/utils/DriverHelper.ts +726 -700
  191. package/utils/KubernetesCommandLineToolsExecutor.ts +196 -180
  192. package/utils/Logger.ts +102 -125
  193. package/utils/ScreenCatcher.ts +57 -46
  194. package/utils/ShellExecutor.ts +19 -11
  195. package/utils/StringUtil.ts +40 -32
  196. package/utils/request-handlers/CheApiRequestHandler.ts +91 -88
  197. package/utils/request-handlers/headers/CheMultiuserAuthorizationHeaderHandler.ts +32 -21
  198. package/utils/request-handlers/headers/IAuthorizationHeaderHandler.ts +3 -3
  199. package/utils/workspace/ApiUrlResolver.ts +31 -26
  200. package/utils/workspace/ITestWorkspaceUtil.ts +31 -31
  201. package/utils/workspace/TestWorkspaceUtil.ts +152 -145
  202. package/utils/workspace/WorkspaceStatus.ts +5 -5
  203. package/constants/APITestConstants.ts +0 -57
  204. package/constants/BaseTestConstants.ts +0 -68
  205. package/constants/ChromeDriverConstants.ts +0 -46
  206. package/constants/FactoryTestConstants.ts +0 -51
  207. package/constants/MonacoConstants.ts +0 -22
  208. package/constants/OAuthConstants.ts +0 -57
  209. package/constants/PluginsTestConstants.ts +0 -15
  210. package/constants/ReporterConstants.ts +0 -45
  211. package/constants/TimeoutConstants.ts +0 -113
  212. package/dist/constants/APITestConstants.js.map +0 -1
  213. package/dist/constants/BaseTestConstants.js.map +0 -1
  214. package/dist/constants/ChromeDriverConstants.js.map +0 -1
  215. package/dist/constants/FactoryTestConstants.js.map +0 -1
  216. package/dist/constants/MonacoConstants.js.map +0 -1
  217. package/dist/constants/OAuthConstants.js.map +0 -1
  218. package/dist/constants/PluginsTestConstants.js.map +0 -1
  219. package/dist/constants/ReporterConstants.js.map +0 -1
  220. package/dist/constants/TimeoutConstants.js.map +0 -1
  221. package/tslint.json +0 -126
@@ -1,5 +1,5 @@
1
- /*********************************************************************
2
- * Copyright (c) 2019-2023 Red Hat, Inc.
1
+ /** *******************************************************************
2
+ * copyright (c) 2019-2023 Red Hat, Inc.
3
3
  *
4
4
  * This program and the accompanying materials are made
5
5
  * available under the terms of the Eclipse Public License 2.0
@@ -13,705 +13,731 @@ import { TYPES } from '../configs/inversify.types';
13
13
  import { Actions, By, error, ThenableWebDriver, until, WebElement } from 'selenium-webdriver';
14
14
  import 'reflect-metadata';
15
15
  import { Logger } from './Logger';
16
- import { TimeoutConstants } from '../constants/TimeoutConstants';
16
+ import { TIMEOUT_CONSTANTS } from '../constants/TIMEOUT_CONSTANTS';
17
17
 
18
18
  @injectable()
19
19
  export class DriverHelper {
20
- private readonly driver: ThenableWebDriver;
21
-
22
- constructor(@inject(TYPES.Driver) driver: IDriver) {
23
- this.driver = driver.get() as ThenableWebDriver;
24
- }
25
-
26
- getAction(): Actions {
27
- Logger.trace();
28
-
29
- return this.driver.actions();
30
- }
31
-
32
- async isVisible(locator: By): Promise<boolean> {
33
- Logger.trace(`${locator}`);
34
-
35
- try {
36
- const element: WebElement = await this.driver.findElement(locator);
37
- return await element.isDisplayed();
38
- } catch {
39
- return false;
40
- }
41
- }
42
-
43
- async wait(milliseconds: number): Promise<void> {
44
- Logger.trace(`(${milliseconds} milliseconds)`);
45
-
46
- await this.driver.sleep(milliseconds);
47
- }
48
-
49
- async refreshPage(): Promise<void> {
50
- Logger.trace();
51
-
52
- await this.driver.navigate().refresh();
53
- }
54
-
55
- async waitVisibilityBoolean(locator: By,
56
- attempts: number = TimeoutConstants.TS_SELENIUM_DEFAULT_ATTEMPTS,
57
- polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<boolean> {
58
-
59
- Logger.trace(`${locator}`);
60
-
61
- for (let i: number = 0; i < attempts; i++) {
62
- const isVisible: boolean = await this.isVisible(locator);
63
-
64
- if (isVisible) {
65
- return true;
66
- }
67
-
68
- await this.wait(polling);
69
- }
70
-
71
- return false;
72
- }
73
-
74
- async waitDisappearanceBoolean(locator: By,
75
- attempts: number = TimeoutConstants.TS_SELENIUM_DEFAULT_ATTEMPTS,
76
- polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<boolean> {
77
-
78
- Logger.trace(`${locator}`);
79
-
80
- for (let i: number = 0; i < attempts; i++) {
81
- const isVisible: boolean = await this.isVisible(locator);
82
-
83
- if (!isVisible) {
84
- return true;
85
- }
86
-
87
- await this.wait(polling);
88
- }
89
-
90
- return false;
91
- }
92
-
93
- async waitVisibility(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<WebElement> {
94
- const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
95
- const attempts: number = Math.ceil(timeout / polling);
96
-
97
- Logger.trace(`${elementLocator}`);
98
-
99
- for (let i: number = 0; i < attempts; i++) {
100
- let element: WebElement;
101
- try {
102
- element = await this.driver.wait(until.elementLocated(elementLocator), polling);
103
- } catch (err) {
104
- if (i >= attempts - 1) {
105
- Logger.error(`failed with exception, out of attempts - ${err}`);
106
- throw err;
107
- }
108
-
109
- if (err instanceof error.TimeoutError) {
110
- if (attempts !== 1) { // waitVisibility was spamming other methods when the number of attempts was 1 - only show message if attempts > 1
111
- Logger.trace(`polling timed out attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
112
- }
113
- continue;
114
- }
115
-
116
- if (err instanceof error.NoSuchWindowError) { // sometimes waitVisibility fails with NoSuchWindowError when the check is run too soon before the page loads
117
- Logger.trace(`failed with NoSuchWindow exception. Attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
118
- continue;
119
- }
120
-
121
- Logger.error(`failed with an unexpected exception - ${err}`);
122
- throw err;
123
- }
124
-
125
- try {
126
- const visibleWebElement: WebElement = await this.driver.wait(until.elementIsVisible(element), polling);
127
- Logger.trace('element is located and is visible.');
128
- return visibleWebElement;
129
- } catch (err) {
130
- if (err instanceof error.TimeoutError) {
131
- if (attempts !== 1) { // waitVisibility was spamming other methods when the number of attempts was 1 - only show message if attempts > 1
132
- Logger.trace(`polling timed out attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
133
- }
134
- continue;
135
- }
136
-
137
- if (err instanceof error.StaleElementReferenceError) {
138
- Logger.debug(`stale element error - ${err}`);
139
- await this.wait(polling);
140
- continue;
141
- }
142
-
143
- Logger.error(`failed with an unexpected exception - ${err}`);
144
- throw err;
145
- }
146
- }
147
-
148
- throw new error.TimeoutError(`Exceeded maximum visibility checking attempts for '${elementLocator}' element, timeouted after ${timeout}`);
149
- }
150
-
151
- async waitPresence(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<WebElement> {
152
- const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
153
- const attempts: number = Math.ceil(timeout / polling);
154
-
155
- Logger.trace(`${elementLocator}`);
156
-
157
- for (let i: number = 0; i < attempts; i++) {
158
- try {
159
- return await this.driver.wait(until.elementLocated(elementLocator), polling);
160
- } catch (err) {
161
- if (err instanceof error.TimeoutError) {
162
- Logger.trace(`polling timed out attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
163
- continue;
164
- }
165
-
166
- if (err instanceof error.StaleElementReferenceError) {
167
- await this.wait(polling);
168
- continue;
169
- }
170
-
171
- Logger.error(`failed with an unexpected exception - ${err}`);
172
- throw err;
173
- }
174
- }
175
-
176
- throw new error.TimeoutError(`Exceeded maximum presence checking attempts, problems with 'StaleElementReferenceError' of '${elementLocator}' element`);
177
- }
178
-
179
- async waitAllPresence(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<Array<WebElement>> {
180
- const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
181
- const attempts: number = Math.ceil(timeout / polling);
182
-
183
- Logger.trace(`${elementLocator}`);
184
-
185
- for (let i: number = 0; i < attempts; i++) {
186
- try {
187
- return await this.driver.wait(until.elementsLocated(elementLocator), polling);
188
- } catch (err) {
189
- if (err instanceof error.TimeoutError) {
190
- Logger.trace(`polling timed out attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
191
- continue;
192
- }
193
-
194
- if (err instanceof error.StaleElementReferenceError) {
195
- await this.wait(polling);
196
- continue;
197
- }
198
-
199
- Logger.error(`failed with an unexpected exception - ${err}`);
200
- throw err;
201
- }
202
- }
203
-
204
- throw new error.TimeoutError(`Exceeded maximum presence checkings attempts, problems with 'StaleElementReferenceError' of '${elementLocator}' element`);
205
- }
206
-
207
- async waitAllVisibility(locators: Array<By>, timeout: number): Promise<void> {
208
- Logger.trace(`${locators}`);
209
-
210
- for (const elementLocator of locators) {
211
- await this.waitVisibility(elementLocator, timeout);
212
- }
213
- }
214
-
215
- async waitDisappearance(elementLocator: By,
216
- attempts: number = TimeoutConstants.TS_SELENIUM_DEFAULT_ATTEMPTS,
217
- polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<void> {
218
-
219
- Logger.trace(`${elementLocator}`);
220
-
221
- const isDisappeared: boolean = await this.waitDisappearanceBoolean(elementLocator, attempts, polling);
222
-
223
- if (!isDisappeared) {
224
- throw new error.TimeoutError(`Waiting attempts exceeded, element '${elementLocator}' is still visible`);
225
- }
226
- }
227
-
228
- async waitDisappearanceWithTimeout(elementLocator: By, timeout: number): Promise<void> {
229
- Logger.trace(`${elementLocator}`);
230
-
231
- await this.getDriver().wait(async () => {
232
- const isVisible: boolean = await this.isVisible(elementLocator);
233
-
234
- if (!isVisible) {
235
- return true;
236
- }
237
- }, timeout);
238
- }
239
-
240
- async waitAllDisappearance(locators: Array<By>,
241
- attemptsPerLocator: number = TimeoutConstants.TS_SELENIUM_DEFAULT_ATTEMPTS,
242
- pollingPerLocator: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING): Promise<void> {
243
-
244
- Logger.trace(`${locators}`);
245
-
246
- for (const elementLocator of locators) {
247
- await this.waitDisappearance(elementLocator, attemptsPerLocator, pollingPerLocator);
248
- }
249
- }
250
-
251
- async waitAndClick(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
252
- const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
253
- const attempts: number = Math.ceil(timeout / polling);
254
-
255
- Logger.trace(`${elementLocator}`);
256
-
257
- for (let i: number = 0; i < attempts; i++) {
258
- let element: WebElement;
259
- try {
260
- element = await this.waitVisibility(elementLocator, polling);
261
- } catch (err) {
262
- if (i >= attempts - 1) {
263
- Logger.error(`failed with exception, out of attempts - ${err}`);
264
- throw err;
265
- }
266
-
267
- if (err instanceof error.TimeoutError) {
268
- Logger.trace(`polling timed out attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
269
- continue;
270
- }
271
-
272
- Logger.error(`failed with an unexpected exception - ${err}`);
273
- throw err;
274
- }
275
-
276
- try {
277
- await element.click();
278
- return;
279
- } catch (err) {
280
- function isElementClickInterceptedOnLastAttempt(err: Error, i: number): boolean {
281
- return err instanceof error.ElementClickInterceptedError && i === attempts - 1;
282
- }
283
-
284
- if (err instanceof error.StaleElementReferenceError || err instanceof error.ElementClickInterceptedError) {
285
- Logger.debug(`${elementLocator} - ${err}`);
286
- await this.wait(polling);
287
- continue;
288
- }
289
-
290
- if (isElementClickInterceptedOnLastAttempt(err, i)) {
291
- Logger.debug(`element is not clickable, try to perform pointer click`);
292
- await this.getAction()
293
- .move({
294
- origin: await this.waitPresence(elementLocator)
295
- })
296
- .click()
297
- .perform();
298
- return;
299
- }
300
-
301
- Logger.error(`failed with an unexpected exception - ${err}`);
302
- throw err;
303
- }
304
- }
305
-
306
- throw new error.TimeoutError(`Exceeded maximum clicking attempts, the '${elementLocator}' element is not clickable`);
307
- }
308
-
309
- async waitAndGetElementAttribute(elementLocator: By, attribute: string,
310
- timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<string> {
311
- const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
312
- const attempts: number = Math.ceil(timeout / polling);
313
-
314
- Logger.trace(`${elementLocator} attribute: '${attribute}'`);
315
-
316
- for (let i: number = 0; i < attempts; i++) {
317
- let element: WebElement;
318
- try {
319
- element = await this.waitVisibility(elementLocator, polling);
320
- } catch (err) {
321
- if (i >= attempts - 1) {
322
- Logger.error(`failed with exception, out of attempts - ${err}`);
323
- throw err;
324
- }
325
-
326
- if (err instanceof error.TimeoutError) {
327
- Logger.trace(`polling timed out attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
328
- continue;
329
- }
330
-
331
- Logger.error(`failed with an unexpected exception - ${err}`);
332
- throw err;
333
- }
334
-
335
- try {
336
- return await element.getAttribute(attribute);
337
- } catch (err) {
338
- if (err instanceof error.StaleElementReferenceError) {
339
- await this.wait(polling);
340
- continue;
341
- }
342
-
343
- Logger.error(`failed with an unexpected exception - ${err}`);
344
- throw err;
345
- }
346
- }
347
-
348
- throw new error.TimeoutError(`Exceeded maximum gettin of the '${attribute}' attribute attempts, from the '${elementLocator}' element`);
349
- }
350
-
351
- async waitAndGetCssValue(elementLocator: By, cssAttribute: string,
352
- timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<string> {
353
- const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
354
- const attempts: number = Math.ceil(timeout / polling);
355
-
356
- Logger.trace(`${elementLocator} cssAttribute: ${cssAttribute}`);
357
-
358
- for (let i: number = 0; i < attempts; i++) {
359
- let element: WebElement;
360
- try {
361
- element = await this.waitVisibility(elementLocator, polling);
362
- } catch (err) {
363
- if (i >= attempts - 1) {
364
- Logger.error(`failed with exception, out of attempts - ${err}`);
365
- throw err;
366
- }
367
-
368
- if (err instanceof error.TimeoutError) {
369
- Logger.trace(`polling timed out attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
370
- continue;
371
- }
372
-
373
- Logger.error(`failed with an unexpected exception - ${err}`);
374
- throw err;
375
- }
376
-
377
- try {
378
- return await element.getCssValue(cssAttribute);
379
- } catch (err) {
380
- if (err instanceof error.StaleElementReferenceError) {
381
- await this.wait(polling);
382
- continue;
383
- }
384
-
385
- Logger.error(`failed with an unexpected exception - ${err}`);
386
- throw err;
387
- }
388
- }
389
-
390
- throw new error.TimeoutError(`Exceeded maximum gettin of the '${cssAttribute}' css attribute attempts, from the '${elementLocator}' element`);
391
- }
392
-
393
- async waitAttributeValue(elementLocator: By,
394
- attribute: string,
395
- expectedValue: string,
396
- timeout: number): Promise<void> {
397
-
398
- Logger.trace(`${elementLocator}`);
399
-
400
- await this.driver.wait(async () => {
401
- const attributeValue: string = await this.waitAndGetElementAttribute(elementLocator, attribute, timeout);
402
-
403
- return expectedValue === attributeValue;
404
- },
405
- timeout,
406
- `The '${attribute}' attribute value doesn't match with expected value '${expectedValue}'`);
407
- }
408
-
409
- async type(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
410
- const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
411
- const attempts: number = Math.ceil(timeout / polling);
412
-
413
- if (elementLocator.toString().toLocaleLowerCase().includes('password')) {
414
- Logger.trace(`${elementLocator} text: ***`);
415
- } else {
416
- Logger.trace(`${elementLocator} text: ${text}`);
417
- }
418
-
419
- for (let i: number = 0; i < attempts; i++) {
420
- let element: WebElement;
421
- try {
422
- element = await this.waitVisibility(elementLocator, polling);
423
- } catch (err) {
424
- if (i >= attempts - 1) {
425
- Logger.error(`failed with exception, out of attempts - ${err}`);
426
- throw err;
427
- }
428
-
429
- if (err instanceof error.TimeoutError) {
430
- Logger.trace(`polling timed out attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
431
- continue;
432
- }
433
-
434
- Logger.error(`failed with an unexpected exception - ${err}`);
435
- throw err;
436
- }
437
-
438
- try {
439
- await element.sendKeys(text);
440
- return;
441
- } catch (err) {
442
- if (err instanceof error.StaleElementReferenceError) {
443
- await this.wait(polling);
444
- continue;
445
- }
446
-
447
- Logger.error(`failed with an unexpected exception - ${err}`);
448
- throw err;
449
- }
450
- }
451
-
452
- throw new error.TimeoutError(`Exceeded maximum typing attempts, to the '${elementLocator}' element`);
453
- }
454
-
455
- async typeToInvisible(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
456
- const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
457
- const attempts: number = Math.ceil(timeout / polling);
458
-
459
- Logger.trace(`${elementLocator} text: ${text}`);
460
-
461
- for (let i: number = 0; i < attempts; i++) {
462
- let element: WebElement;
463
- try {
464
- element = await this.waitPresence(elementLocator, polling);
465
- } catch (err) {
466
- if (i >= attempts - 1) {
467
- Logger.error(`failed with exception, out of attempts - ${err}`);
468
- throw err;
469
- }
470
-
471
- if (err instanceof error.TimeoutError) {
472
- Logger.trace(`polling timed out attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
473
- continue;
474
- }
475
-
476
- Logger.error(`failed with an unexpected exception - ${err}`);
477
- throw err;
478
- }
479
-
480
- try {
481
- await element.sendKeys(text);
482
- return;
483
- } catch (err) {
484
- if (err instanceof error.StaleElementReferenceError) {
485
- await this.wait(polling);
486
- continue;
487
- }
488
-
489
- Logger.error(`failed with an unexpected exception - ${err}`);
490
- throw err;
491
- }
492
- }
493
-
494
- throw new error.TimeoutError(`Exceeded maximum typing attempts, to the '${elementLocator}' element`);
495
- }
496
-
497
- async clear(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
498
- const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
499
- const attempts: number = Math.ceil(timeout / polling);
500
-
501
- Logger.trace(`${elementLocator}`);
502
-
503
- for (let i: number = 0; i < attempts; i++) {
504
- let element: WebElement;
505
- try {
506
- element = await this.waitVisibility(elementLocator, polling);
507
- } catch (err) {
508
- if (i >= attempts - 1) {
509
- Logger.error(`failed with exception, out of attempts - ${err}`);
510
- throw err;
511
- }
512
-
513
- if (err instanceof error.TimeoutError) {
514
- Logger.trace(`polling timed out attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
515
- continue;
516
- }
517
-
518
- Logger.error(`failed with an unexpected exception - ${err}`);
519
- throw err;
520
- }
521
-
522
- try {
523
- await element.clear();
524
- return;
525
- } catch (err) {
526
- if (err instanceof error.StaleElementReferenceError) {
527
- await this.wait(polling);
528
- continue;
529
- }
530
-
531
- Logger.error(`failed with an unexpected exception - ${err}`);
532
- throw err;
533
- }
534
- }
535
-
536
- throw new error.TimeoutError(`Exceeded maximum clearing attempts, to the '${elementLocator}' element`);
537
- }
538
-
539
- async clearInvisible(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
540
- const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
541
- const attempts: number = Math.ceil(timeout / polling);
542
-
543
- Logger.trace(`${elementLocator}`);
544
-
545
- for (let i: number = 0; i < attempts; i++) {
546
- let element: WebElement;
547
- try {
548
- element = await this.waitPresence(elementLocator, polling);
549
- } catch (err) {
550
- if (i >= attempts - 1) {
551
- Logger.error(`failed with exception, out of attempts - ${err}`);
552
- throw err;
553
- }
554
-
555
- if (err instanceof error.TimeoutError) {
556
- Logger.trace(`polling timed out attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
557
- continue;
558
- }
559
-
560
- Logger.error(`failed with an unexpected exception - ${err}`);
561
- throw err;
562
- }
563
-
564
- try {
565
- await element.clear();
566
- return;
567
- } catch (err) {
568
- if (err instanceof error.StaleElementReferenceError) {
569
- await this.wait(polling);
570
- continue;
571
- }
572
-
573
- Logger.error(`failed with an unexpected exception - ${err}`);
574
- throw err;
575
- }
576
- }
577
-
578
- throw new error.TimeoutError(`Exceeded maximum clearing attempts, to the '${elementLocator}' element`);
579
- }
580
-
581
- async enterValue(elementLocator: By, text: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
582
- if (elementLocator.toString().toLocaleLowerCase().includes('password')) {
583
- Logger.trace(`${elementLocator} text: ***`);
584
- } else {
585
- Logger.trace(`${elementLocator} text: ${text}`);
586
- }
587
-
588
- await this.waitVisibility(elementLocator, timeout);
589
- await this.clear(elementLocator);
590
- await this.waitAttributeValue(elementLocator, 'value', '', timeout);
591
- await this.type(elementLocator, text, timeout);
592
- await this.waitAttributeValue(elementLocator, 'value', text, timeout);
593
- }
594
-
595
- async waitAndSwitchToFrame(iframeLocator: By, timeout: number): Promise<void> {
596
- Logger.trace(`${iframeLocator}`);
597
-
598
- await this.driver.wait(until.ableToSwitchToFrame(iframeLocator), timeout);
599
- }
600
-
601
- async waitAndGetText(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<string> {
602
- const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
603
- const attempts: number = Math.ceil(timeout / polling);
604
-
605
- Logger.trace(`${elementLocator}`);
606
-
607
- for (let i: number = 0; i < attempts; i++) {
608
- let element: WebElement;
609
- try {
610
- element = await this.waitVisibility(elementLocator, polling);
611
- } catch (err) {
612
- if (i >= attempts - 1) {
613
- Logger.error(`failed with exception, out of attempts - ${err}`);
614
- throw err;
615
- }
616
-
617
- if (err instanceof error.TimeoutError) {
618
- Logger.trace(`polling timed out attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
619
- continue;
620
- }
621
-
622
- Logger.error(`failed with an unexpected exception - ${err}`);
623
- throw err;
624
- }
625
-
626
- try {
627
- return await element.getText();
628
- } catch (err) {
629
- if (err instanceof error.StaleElementReferenceError) {
630
- await this.wait(polling);
631
- continue;
632
- }
633
-
634
- Logger.error(`failed with an unexpected exception - ${err}`);
635
- throw err;
636
- }
637
- }
638
-
639
- throw new error.TimeoutError(`Exceeded maximum text obtaining attempts, from the '${elementLocator}' element`);
640
- }
641
-
642
- async waitAndGetValue(elementLocator: By, timeout: number): Promise<string> {
643
- Logger.trace(`${elementLocator}`);
644
-
645
- return await this.waitAndGetElementAttribute(elementLocator, 'value', timeout);
646
- }
647
-
648
- async waitUntilTrue(callback: any, timeout: number): Promise<void> {
649
- Logger.trace();
650
-
651
- await this.driver.wait(callback, timeout);
652
- }
653
-
654
- async scrollTo(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
655
- const polling: number = TimeoutConstants.TS_SELENIUM_DEFAULT_POLLING;
656
- const attempts: number = Math.ceil(timeout / polling);
657
-
658
- Logger.trace(`${elementLocator}`);
659
-
660
- for (let i: number = 0; i < attempts; i++) {
661
- let element: WebElement;
662
- try {
663
- element = await this.waitPresence(elementLocator, polling);
664
- } catch (err) {
665
- if (i >= attempts - 1) {
666
- Logger.error(`failed with exception, out of attempts - ${err}`);
667
- throw err;
668
- }
669
-
670
- if (err instanceof error.TimeoutError) {
671
- Logger.trace(`polling timed out attempt #${(i + 1)}, retrying with ${polling}ms timeout`);
672
- continue;
673
- }
674
-
675
- Logger.error(`failed with an unexpected exception - ${err}`);
676
- throw err;
677
- }
678
-
679
- try {
680
- await this.getDriver()
681
- .executeScript('arguments[0].scrollIntoView(true);', element);
682
- return;
683
- } catch (err) {
684
- if (err instanceof error.StaleElementReferenceError) {
685
- await this.wait(polling);
686
- continue;
687
- }
688
-
689
- Logger.error(`failed with an unexpected exception - ${err}`);
690
- throw err;
691
- }
692
- }
693
-
694
- throw new error.TimeoutError(`Exceeded maximum mouse move attempts, for the '${elementLocator}' element`);
695
- }
696
-
697
- async scrollToAndClick(elementLocator: By, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
698
- await this.scrollTo(elementLocator, timeout);
699
- await this.waitAndClick(elementLocator, timeout);
700
- }
701
-
702
- async scrollToAndEnterValue(elementLocator: By, value: string, timeout: number = TimeoutConstants.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
703
- await this.scrollTo(elementLocator, timeout);
704
- await this.enterValue(elementLocator, value, timeout);
705
- }
706
-
707
- // method is useful to debug page object elements
708
- async highLightElement(element: WebElement): Promise<void> {
709
- await this.getDriver().executeScript('arguments[0].style.border=\'2px solid red\'', element);
710
- }
711
-
712
- getDriver(): ThenableWebDriver {
713
- Logger.trace();
714
-
715
- return this.driver;
716
- }
20
+ private readonly driver: ThenableWebDriver;
21
+
22
+ constructor(@inject(TYPES.Driver) driver: IDriver) {
23
+ this.driver = driver.get();
24
+ }
25
+
26
+ getAction(): Actions {
27
+ Logger.trace();
28
+
29
+ return this.driver.actions();
30
+ }
31
+
32
+ async isVisible(locator: By): Promise<boolean> {
33
+ Logger.trace(`${locator}`);
34
+
35
+ try {
36
+ const element: WebElement = await this.driver.findElement(locator);
37
+ return await element.isDisplayed();
38
+ } catch {
39
+ return false;
40
+ }
41
+ }
42
+
43
+ async wait(milliseconds: number): Promise<void> {
44
+ Logger.trace(`(${milliseconds} milliseconds)`);
45
+
46
+ await this.driver.sleep(milliseconds);
47
+ }
48
+
49
+ async refreshPage(): Promise<void> {
50
+ Logger.trace();
51
+
52
+ await this.driver.navigate().refresh();
53
+ }
54
+
55
+ async waitVisibilityBoolean(
56
+ locator: By,
57
+ attempts: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_ATTEMPTS,
58
+ polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING
59
+ ): Promise<boolean> {
60
+ Logger.trace(`${locator}`);
61
+
62
+ for (let i: number = 0; i < attempts; i++) {
63
+ const isVisible: boolean = await this.isVisible(locator);
64
+
65
+ if (isVisible) {
66
+ return true;
67
+ }
68
+
69
+ await this.wait(polling);
70
+ }
71
+
72
+ return false;
73
+ }
74
+
75
+ async waitDisappearanceBoolean(
76
+ locator: By,
77
+ attempts: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_ATTEMPTS,
78
+ polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING
79
+ ): Promise<boolean> {
80
+ Logger.trace(`${locator}`);
81
+
82
+ for (let i: number = 0; i < attempts; i++) {
83
+ const isVisible: boolean = await this.isVisible(locator);
84
+
85
+ if (!isVisible) {
86
+ return true;
87
+ }
88
+
89
+ await this.wait(polling);
90
+ }
91
+
92
+ return false;
93
+ }
94
+
95
+ async waitVisibility(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<WebElement> {
96
+ const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
97
+ const attempts: number = Math.ceil(timeout / polling);
98
+
99
+ Logger.trace(`${elementLocator}`);
100
+
101
+ for (let i: number = 0; i < attempts; i++) {
102
+ let element: WebElement;
103
+ try {
104
+ element = await this.driver.wait(until.elementLocated(elementLocator), polling);
105
+ } catch (err) {
106
+ if (i >= attempts - 1) {
107
+ Logger.error(`failed with exception, out of attempts - ${err}`);
108
+ throw err;
109
+ }
110
+
111
+ if (err instanceof error.TimeoutError) {
112
+ if (attempts !== 1) {
113
+ // waitVisibility was spamming other methods when the number of attempts was 1 - only show message if attempts > 1
114
+ Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
115
+ }
116
+ continue;
117
+ }
118
+
119
+ if (err instanceof error.NoSuchWindowError) {
120
+ // sometimes waitVisibility fails with NoSuchWindowError when the check is run too soon before the page loads
121
+ Logger.trace(`failed with NoSuchWindow exception. Attempt #${i + 1}, retrying with ${polling}ms timeout`);
122
+ continue;
123
+ }
124
+
125
+ Logger.error(`failed with an unexpected exception - ${err}`);
126
+ throw err;
127
+ }
128
+
129
+ try {
130
+ const visibleWebElement: WebElement = await this.driver.wait(until.elementIsVisible(element), polling);
131
+ Logger.trace('element is located and is visible.');
132
+ return visibleWebElement;
133
+ } catch (err) {
134
+ if (err instanceof error.TimeoutError) {
135
+ if (attempts !== 1) {
136
+ // waitVisibility was spamming other methods when the number of attempts was 1 - only show message if attempts > 1
137
+ Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
138
+ }
139
+ continue;
140
+ }
141
+
142
+ if (err instanceof error.StaleElementReferenceError) {
143
+ Logger.debug(`stale element error - ${JSON.stringify(err)}`);
144
+ await this.wait(polling);
145
+ continue;
146
+ }
147
+
148
+ Logger.error(`failed with an unexpected exception - ${err}`);
149
+ throw err;
150
+ }
151
+ }
152
+
153
+ throw new error.TimeoutError(
154
+ `Exceeded maximum visibility checking attempts for '${elementLocator}' element, timeouted after ${timeout}`
155
+ );
156
+ }
157
+
158
+ async waitPresence(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<WebElement> {
159
+ const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
160
+ const attempts: number = Math.ceil(timeout / polling);
161
+
162
+ Logger.trace(`${elementLocator}`);
163
+
164
+ for (let i: number = 0; i < attempts; i++) {
165
+ try {
166
+ return await this.driver.wait(until.elementLocated(elementLocator), polling);
167
+ } catch (err) {
168
+ if (err instanceof error.TimeoutError) {
169
+ Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
170
+ continue;
171
+ }
172
+
173
+ if (err instanceof error.StaleElementReferenceError) {
174
+ await this.wait(polling);
175
+ continue;
176
+ }
177
+
178
+ Logger.error(`failed with an unexpected exception - ${err}`);
179
+ throw err;
180
+ }
181
+ }
182
+
183
+ throw new error.TimeoutError(
184
+ `Exceeded maximum presence checking attempts, problems with 'StaleElementReferenceError' of '${elementLocator}' element`
185
+ );
186
+ }
187
+
188
+ async waitAllPresence(
189
+ elementLocator: By,
190
+ timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM
191
+ ): Promise<Array<WebElement>> {
192
+ const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
193
+ const attempts: number = Math.ceil(timeout / polling);
194
+
195
+ Logger.trace(`${elementLocator}`);
196
+
197
+ for (let i: number = 0; i < attempts; i++) {
198
+ try {
199
+ return await this.driver.wait(until.elementsLocated(elementLocator), polling);
200
+ } catch (err) {
201
+ if (err instanceof error.TimeoutError) {
202
+ Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
203
+ continue;
204
+ }
205
+
206
+ if (err instanceof error.StaleElementReferenceError) {
207
+ await this.wait(polling);
208
+ continue;
209
+ }
210
+
211
+ Logger.error(`failed with an unexpected exception - ${err}`);
212
+ throw err;
213
+ }
214
+ }
215
+
216
+ throw new error.TimeoutError(
217
+ `Exceeded maximum presence checkings attempts, problems with 'StaleElementReferenceError' of '${elementLocator}' element`
218
+ );
219
+ }
220
+
221
+ async waitAllVisibility(locators: Array<By>, timeout: number): Promise<void> {
222
+ Logger.trace(`${locators}`);
223
+
224
+ for (const elementLocator of locators) {
225
+ await this.waitVisibility(elementLocator, timeout);
226
+ }
227
+ }
228
+
229
+ async waitDisappearance(
230
+ elementLocator: By,
231
+ attempts: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_ATTEMPTS,
232
+ polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING
233
+ ): Promise<void> {
234
+ Logger.trace(`${elementLocator}`);
235
+
236
+ const isDisappeared: boolean = await this.waitDisappearanceBoolean(elementLocator, attempts, polling);
237
+
238
+ if (!isDisappeared) {
239
+ throw new error.TimeoutError(`Waiting attempts exceeded, element '${elementLocator}' is still visible`);
240
+ }
241
+ }
242
+
243
+ async waitAllDisappearance(
244
+ locators: Array<By>,
245
+ attemptsPerLocator: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_ATTEMPTS,
246
+ pollingPerLocator: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING
247
+ ): Promise<void> {
248
+ Logger.trace(`${locators}`);
249
+ try {
250
+ for (const elementLocator of locators) {
251
+ await this.waitDisappearance(elementLocator, attemptsPerLocator, pollingPerLocator);
252
+ }
253
+ } catch (e) {
254
+ throw e;
255
+ }
256
+ }
257
+
258
+ async waitAndClick(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
259
+ const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
260
+ const attempts: number = Math.ceil(timeout / polling);
261
+
262
+ Logger.trace(`${elementLocator}`);
263
+
264
+ for (let i: number = 0; i < attempts; i++) {
265
+ let element: WebElement;
266
+ try {
267
+ element = await this.waitVisibility(elementLocator, polling);
268
+ } catch (err) {
269
+ if (i >= attempts - 1) {
270
+ Logger.error(`failed with exception, out of attempts - ${err}`);
271
+ throw err;
272
+ }
273
+
274
+ if (err instanceof error.TimeoutError) {
275
+ Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
276
+ continue;
277
+ }
278
+
279
+ Logger.error(`failed with an unexpected exception - ${err}`);
280
+ throw err;
281
+ }
282
+
283
+ try {
284
+ await element.click();
285
+ return;
286
+ } catch (err) {
287
+ function isElementClickInterceptedOnLastAttempt(err: Error, i: number): boolean {
288
+ return err instanceof error.ElementClickInterceptedError && i === attempts - 1;
289
+ }
290
+
291
+ if (err instanceof error.StaleElementReferenceError || err instanceof error.ElementClickInterceptedError) {
292
+ Logger.debug(`${elementLocator} - ${JSON.stringify(err)}`);
293
+ await this.wait(polling);
294
+ continue;
295
+ }
296
+
297
+ if (isElementClickInterceptedOnLastAttempt(err, i)) {
298
+ Logger.debug('element is not clickable, try to perform pointer click');
299
+ await this.getAction()
300
+ .move({
301
+ origin: await this.waitPresence(elementLocator)
302
+ })
303
+ .click()
304
+ .perform();
305
+ return;
306
+ }
307
+
308
+ Logger.error(`failed with an unexpected exception - ${err}`);
309
+ throw err;
310
+ }
311
+ }
312
+
313
+ throw new error.TimeoutError(`Exceeded maximum clicking attempts, the '${elementLocator}' element is not clickable`);
314
+ }
315
+
316
+ async waitAndGetElementAttribute(
317
+ elementLocator: By,
318
+ attribute: string,
319
+ timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM
320
+ ): Promise<string> {
321
+ const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
322
+ const attempts: number = Math.ceil(timeout / polling);
323
+
324
+ Logger.trace(`${elementLocator} attribute: '${attribute}'`);
325
+
326
+ for (let i: number = 0; i < attempts; i++) {
327
+ let element: WebElement;
328
+ try {
329
+ element = await this.waitVisibility(elementLocator, polling);
330
+ } catch (err) {
331
+ if (i >= attempts - 1) {
332
+ Logger.error(`failed with exception, out of attempts - ${err}`);
333
+ throw err;
334
+ }
335
+
336
+ if (err instanceof error.TimeoutError) {
337
+ Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
338
+ continue;
339
+ }
340
+
341
+ Logger.error(`failed with an unexpected exception - ${err}`);
342
+ throw err;
343
+ }
344
+
345
+ try {
346
+ return await element.getAttribute(attribute);
347
+ } catch (err) {
348
+ if (err instanceof error.StaleElementReferenceError) {
349
+ await this.wait(polling);
350
+ continue;
351
+ }
352
+
353
+ Logger.error(`failed with an unexpected exception - ${err}`);
354
+ throw err;
355
+ }
356
+ }
357
+
358
+ throw new error.TimeoutError(
359
+ `Exceeded maximum gettin of the '${attribute}' attribute attempts, from the '${elementLocator}' element`
360
+ );
361
+ }
362
+
363
+ async waitAndGetCssValue(
364
+ elementLocator: By,
365
+ cssAttribute: string,
366
+ timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM
367
+ ): Promise<string> {
368
+ const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
369
+ const attempts: number = Math.ceil(timeout / polling);
370
+
371
+ Logger.trace(`${elementLocator} cssAttribute: ${cssAttribute}`);
372
+
373
+ for (let i: number = 0; i < attempts; i++) {
374
+ let element: WebElement;
375
+ try {
376
+ element = await this.waitVisibility(elementLocator, polling);
377
+ } catch (err) {
378
+ if (i >= attempts - 1) {
379
+ Logger.error(`failed with exception, out of attempts - ${err}`);
380
+ throw err;
381
+ }
382
+
383
+ if (err instanceof error.TimeoutError) {
384
+ Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
385
+ continue;
386
+ }
387
+
388
+ Logger.error(`failed with an unexpected exception - ${err}`);
389
+ throw err;
390
+ }
391
+
392
+ try {
393
+ return await element.getCssValue(cssAttribute);
394
+ } catch (err) {
395
+ if (err instanceof error.StaleElementReferenceError) {
396
+ await this.wait(polling);
397
+ continue;
398
+ }
399
+
400
+ Logger.error(`failed with an unexpected exception - ${err}`);
401
+ throw err;
402
+ }
403
+ }
404
+
405
+ throw new error.TimeoutError(
406
+ `Exceeded maximum gettin of the '${cssAttribute}' css attribute attempts, from the '${elementLocator}' element`
407
+ );
408
+ }
409
+
410
+ async waitAttributeValue(elementLocator: By, attribute: string, expectedValue: string, timeout: number): Promise<void> {
411
+ Logger.trace(`${elementLocator}`);
412
+
413
+ await this.driver.wait(
414
+ async (): Promise<boolean> => {
415
+ const attributeValue: string = await this.waitAndGetElementAttribute(elementLocator, attribute, timeout);
416
+
417
+ return expectedValue === attributeValue;
418
+ },
419
+ timeout,
420
+ `The '${attribute}' attribute value doesn't match with expected value '${expectedValue}'`
421
+ );
422
+ }
423
+
424
+ async type(elementLocator: By, text: string, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
425
+ const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
426
+ const attempts: number = Math.ceil(timeout / polling);
427
+
428
+ if (elementLocator.toString().toLocaleLowerCase().includes('password')) {
429
+ Logger.trace(`${elementLocator} text: ***`);
430
+ } else {
431
+ Logger.trace(`${elementLocator} text: ${text}`);
432
+ }
433
+
434
+ for (let i: number = 0; i < attempts; i++) {
435
+ let element: WebElement;
436
+ try {
437
+ element = await this.waitVisibility(elementLocator, polling);
438
+ } catch (err) {
439
+ if (i >= attempts - 1) {
440
+ Logger.error(`failed with exception, out of attempts - ${err}`);
441
+ throw err;
442
+ }
443
+
444
+ if (err instanceof error.TimeoutError) {
445
+ Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
446
+ continue;
447
+ }
448
+
449
+ Logger.error(`failed with an unexpected exception - ${err}`);
450
+ throw err;
451
+ }
452
+
453
+ try {
454
+ await element.sendKeys(text);
455
+ return;
456
+ } catch (err) {
457
+ if (err instanceof error.StaleElementReferenceError) {
458
+ await this.wait(polling);
459
+ continue;
460
+ }
461
+
462
+ Logger.error(`failed with an unexpected exception - ${err}`);
463
+ throw err;
464
+ }
465
+ }
466
+
467
+ throw new error.TimeoutError(`Exceeded maximum typing attempts, to the '${elementLocator}' element`);
468
+ }
469
+
470
+ async typeToInvisible(
471
+ elementLocator: By,
472
+ text: string,
473
+ timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM
474
+ ): Promise<void> {
475
+ const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
476
+ const attempts: number = Math.ceil(timeout / polling);
477
+
478
+ Logger.trace(`${elementLocator} text: ${text}`);
479
+
480
+ for (let i: number = 0; i < attempts; i++) {
481
+ let element: WebElement;
482
+ try {
483
+ element = await this.waitPresence(elementLocator, polling);
484
+ } catch (err) {
485
+ if (i >= attempts - 1) {
486
+ Logger.error(`failed with exception, out of attempts - ${err}`);
487
+ throw err;
488
+ }
489
+
490
+ if (err instanceof error.TimeoutError) {
491
+ Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
492
+ continue;
493
+ }
494
+
495
+ Logger.error(`failed with an unexpected exception - ${err}`);
496
+ throw err;
497
+ }
498
+
499
+ try {
500
+ await element.sendKeys(text);
501
+ return;
502
+ } catch (err) {
503
+ if (err instanceof error.StaleElementReferenceError) {
504
+ await this.wait(polling);
505
+ continue;
506
+ }
507
+
508
+ Logger.error(`failed with an unexpected exception - ${err}`);
509
+ throw err;
510
+ }
511
+ }
512
+
513
+ throw new error.TimeoutError(`Exceeded maximum typing attempts, to the '${elementLocator}' element`);
514
+ }
515
+
516
+ async clear(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
517
+ const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
518
+ const attempts: number = Math.ceil(timeout / polling);
519
+
520
+ Logger.trace(`${elementLocator}`);
521
+
522
+ for (let i: number = 0; i < attempts; i++) {
523
+ let element: WebElement;
524
+ try {
525
+ element = await this.waitVisibility(elementLocator, polling);
526
+ } catch (err) {
527
+ if (i >= attempts - 1) {
528
+ Logger.error(`failed with exception, out of attempts - ${err}`);
529
+ throw err;
530
+ }
531
+
532
+ if (err instanceof error.TimeoutError) {
533
+ Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
534
+ continue;
535
+ }
536
+
537
+ Logger.error(`failed with an unexpected exception - ${err}`);
538
+ throw err;
539
+ }
540
+
541
+ try {
542
+ await element.clear();
543
+ return;
544
+ } catch (err) {
545
+ if (err instanceof error.StaleElementReferenceError) {
546
+ await this.wait(polling);
547
+ continue;
548
+ }
549
+
550
+ Logger.error(`failed with an unexpected exception - ${err}`);
551
+ throw err;
552
+ }
553
+ }
554
+
555
+ throw new error.TimeoutError(`Exceeded maximum clearing attempts, to the '${elementLocator}' element`);
556
+ }
557
+
558
+ async clearInvisible(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
559
+ const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
560
+ const attempts: number = Math.ceil(timeout / polling);
561
+
562
+ Logger.trace(`${elementLocator}`);
563
+
564
+ for (let i: number = 0; i < attempts; i++) {
565
+ let element: WebElement;
566
+ try {
567
+ element = await this.waitPresence(elementLocator, polling);
568
+ } catch (err) {
569
+ if (i >= attempts - 1) {
570
+ Logger.error(`failed with exception, out of attempts - ${err}`);
571
+ throw err;
572
+ }
573
+
574
+ if (err instanceof error.TimeoutError) {
575
+ Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
576
+ continue;
577
+ }
578
+
579
+ Logger.error(`failed with an unexpected exception - ${err}`);
580
+ throw err;
581
+ }
582
+
583
+ try {
584
+ await element.clear();
585
+ return;
586
+ } catch (err) {
587
+ if (err instanceof error.StaleElementReferenceError) {
588
+ await this.wait(polling);
589
+ continue;
590
+ }
591
+
592
+ Logger.error(`failed with an unexpected exception - ${err}`);
593
+ throw err;
594
+ }
595
+ }
596
+
597
+ throw new error.TimeoutError(`Exceeded maximum clearing attempts, to the '${elementLocator}' element`);
598
+ }
599
+
600
+ async enterValue(
601
+ elementLocator: By,
602
+ text: string,
603
+ timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM
604
+ ): Promise<void> {
605
+ if (elementLocator.toString().toLocaleLowerCase().includes('password')) {
606
+ Logger.trace(`${elementLocator} text: ***`);
607
+ } else {
608
+ Logger.trace(`${elementLocator} text: ${text}`);
609
+ }
610
+
611
+ await this.waitVisibility(elementLocator, timeout);
612
+ await this.clear(elementLocator);
613
+ await this.waitAttributeValue(elementLocator, 'value', '', timeout);
614
+ await this.type(elementLocator, text, timeout);
615
+ await this.waitAttributeValue(elementLocator, 'value', text, timeout);
616
+ }
617
+
618
+ async waitAndSwitchToFrame(iframeLocator: By, timeout: number): Promise<void> {
619
+ Logger.trace(`${iframeLocator}`);
620
+
621
+ await this.driver.wait(until.ableToSwitchToFrame(iframeLocator), timeout);
622
+ }
623
+
624
+ async waitAndGetText(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<string> {
625
+ const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
626
+ const attempts: number = Math.ceil(timeout / polling);
627
+
628
+ Logger.trace(`${elementLocator}`);
629
+
630
+ for (let i: number = 0; i < attempts; i++) {
631
+ let element: WebElement;
632
+ try {
633
+ element = await this.waitVisibility(elementLocator, polling);
634
+ } catch (err) {
635
+ if (i >= attempts - 1) {
636
+ Logger.error(`failed with exception, out of attempts - ${err}`);
637
+ throw err;
638
+ }
639
+
640
+ if (err instanceof error.TimeoutError) {
641
+ Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
642
+ continue;
643
+ }
644
+
645
+ Logger.error(`failed with an unexpected exception - ${err}`);
646
+ throw err;
647
+ }
648
+
649
+ try {
650
+ return await element.getText();
651
+ } catch (err) {
652
+ if (err instanceof error.StaleElementReferenceError) {
653
+ await this.wait(polling);
654
+ continue;
655
+ }
656
+
657
+ Logger.error(`failed with an unexpected exception - ${err}`);
658
+ throw err;
659
+ }
660
+ }
661
+
662
+ throw new error.TimeoutError(`Exceeded maximum text obtaining attempts, from the '${elementLocator}' element`);
663
+ }
664
+
665
+ async waitAndGetValue(elementLocator: By, timeout: number): Promise<string> {
666
+ Logger.trace(`${elementLocator}`);
667
+
668
+ return await this.waitAndGetElementAttribute(elementLocator, 'value', timeout);
669
+ }
670
+
671
+ async waitUntilTrue(callback: any, timeout: number): Promise<void> {
672
+ Logger.trace();
673
+
674
+ await this.driver.wait(callback, timeout);
675
+ }
676
+
677
+ async scrollTo(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
678
+ const polling: number = TIMEOUT_CONSTANTS.TS_SELENIUM_DEFAULT_POLLING;
679
+ const attempts: number = Math.ceil(timeout / polling);
680
+
681
+ Logger.trace(`${elementLocator}`);
682
+
683
+ for (let i: number = 0; i < attempts; i++) {
684
+ let element: WebElement;
685
+ try {
686
+ element = await this.waitPresence(elementLocator, polling);
687
+ } catch (err) {
688
+ if (i >= attempts - 1) {
689
+ Logger.error(`failed with exception, out of attempts - ${err}`);
690
+ throw err;
691
+ }
692
+
693
+ if (err instanceof error.TimeoutError) {
694
+ Logger.trace(`polling timed out attempt #${i + 1}, retrying with ${polling}ms timeout`);
695
+ continue;
696
+ }
697
+
698
+ Logger.error(`failed with an unexpected exception - ${err}`);
699
+ throw err;
700
+ }
701
+
702
+ try {
703
+ await this.getDriver().executeScript('arguments[0].scrollIntoView(true);', element);
704
+ return;
705
+ } catch (err) {
706
+ if (err instanceof error.StaleElementReferenceError) {
707
+ await this.wait(polling);
708
+ continue;
709
+ }
710
+
711
+ Logger.error(`failed with an unexpected exception - ${err}`);
712
+ throw err;
713
+ }
714
+ }
715
+
716
+ throw new error.TimeoutError(`Exceeded maximum mouse move attempts, for the '${elementLocator}' element`);
717
+ }
718
+
719
+ async scrollToAndClick(elementLocator: By, timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM): Promise<void> {
720
+ await this.scrollTo(elementLocator, timeout);
721
+ await this.waitAndClick(elementLocator, timeout);
722
+ }
723
+
724
+ async scrollToAndEnterValue(
725
+ elementLocator: By,
726
+ value: string,
727
+ timeout: number = TIMEOUT_CONSTANTS.TS_SELENIUM_CLICK_ON_VISIBLE_ITEM
728
+ ): Promise<void> {
729
+ await this.scrollTo(elementLocator, timeout);
730
+ await this.enterValue(elementLocator, value, timeout);
731
+ }
732
+
733
+ // method is useful to debug page object elements
734
+ async highLightElement(element: WebElement): Promise<void> {
735
+ await this.getDriver().executeScript('arguments[0].style.border="2px solid red"', element);
736
+ }
737
+
738
+ getDriver(): ThenableWebDriver {
739
+ Logger.trace();
740
+
741
+ return this.driver;
742
+ }
717
743
  }