|
9 | 9 | import aquality.selenium.core.localization.ILocalizationManager;
|
10 | 10 | import aquality.selenium.core.localization.ILocalizedLogger;
|
11 | 11 | import aquality.selenium.core.waitings.IConditionalWait;
|
12 |
| -import org.apache.commons.io.IOUtils; |
13 |
| -import org.apache.commons.lang3.NotImplementedException; |
14 | 12 | import org.openqa.selenium.*;
|
15 | 13 | import org.openqa.selenium.WebDriver.Navigation;
|
16 | 14 | import org.openqa.selenium.devtools.HasDevTools;
|
|
21 | 19 |
|
22 | 20 | import java.io.File;
|
23 | 21 | import java.io.IOException;
|
24 |
| -import java.nio.charset.StandardCharsets; |
25 | 22 | import java.time.Duration;
|
26 | 23 | import java.util.function.Supplier;
|
27 | 24 |
|
@@ -147,7 +144,8 @@ public IBrowserTabNavigation tabs() {
|
147 | 144 | }
|
148 | 145 |
|
149 | 146 | /**
|
150 |
| - * Sets page load timeout (Will be ignored for Safari https://github.com/SeleniumHQ/selenium-google-code-issue-archive/issues/687) |
| 147 | + * Sets page load timeout (Will be ignored for Safari |
| 148 | + * <a href="https://github.com/SeleniumHQ/selenium-google-code-issue-archive/issues/687">...</a>) |
151 | 149 | *
|
152 | 150 | * @param timeout seconds to wait
|
153 | 151 | */
|
@@ -248,10 +246,9 @@ public Object executeAsyncScript(JavaScript scriptName, Object... args) {
|
248 | 246 | * @param file Java Script file
|
249 | 247 | * @param arguments Arguments for the script (web elements, values etc.
|
250 | 248 | * @return Result object of script execution
|
251 |
| - * @throws IOException in case of problems with the File |
252 | 249 | */
|
253 |
| - public Object executeAsyncScript(final File file, Object... arguments) throws IOException { |
254 |
| - return executeAsyncScript(IOUtils.toString(file.toURI(), StandardCharsets.UTF_8.name()), arguments); |
| 250 | + public Object executeAsyncScript(final File file, Object... arguments) { |
| 251 | + return executeAsyncScript(JavaScript.readScript(file), arguments); |
255 | 252 | }
|
256 | 253 |
|
257 | 254 | /**
|
@@ -303,7 +300,7 @@ public Object executeScript(JavaScript scriptName, Object... args) {
|
303 | 300 | * @throws IOException in case of problems with the File
|
304 | 301 | */
|
305 | 302 | public Object executeScript(final File file, Object... arguments) throws IOException {
|
306 |
| - return executeScript(IOUtils.toString(file.toURI(), StandardCharsets.UTF_8.name()), arguments); |
| 303 | + return executeScript(JavaScript.readScript(file), arguments); |
307 | 304 | }
|
308 | 305 |
|
309 | 306 | /**
|
@@ -400,7 +397,7 @@ public DevToolsHandling devTools() {
|
400 | 397 | return devTools;
|
401 | 398 | }
|
402 | 399 | else {
|
403 |
| - throw new NotImplementedException("DevTools protocol is not supported for current browser."); |
| 400 | + throw new UnsupportedOperationException("DevTools protocol is not supported for current browser."); |
404 | 401 | }
|
405 | 402 | }
|
406 | 403 |
|
|
0 commit comments