Skip to content

Commit b20211c

Browse files
committed
[1.4.2-documentation] - added java docs
1 parent 49f71e9 commit b20211c

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

readme.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
* For Web local run:
4141

4242
IS_LOCAL=True
43-
BROWSER=Firefox|Chrome|IE|Safari
43+
BROWSER=Firefox|Chrome|IE|Safari|EDGE
4444

4545
* For Web remote run:
4646

4747
IS_REMOTE=True
48-
BROWSER=Firefox|Chrome|IE|Safari
48+
BROWSER=Firefox|Chrome|IE|Safari|EDGE
4949
EXECUTOR=http://{host}:{port}/wd/hub
5050
(optional available with Chrome only) MOBILE_DEVICE_EMULATION=Google Nexus 5|Apple iPhone 6|Samsung Galaxy S5
5151

@@ -316,6 +316,7 @@
316316
DriverHelper.scrollUpMobileElement(AppiumDriver driver, MobileElement element)
317317
DriverHelper.scrollDownMobileElement(AppiumDriver driver, MobileElement element, int duration) - duration not less than 500ms
318318
DriverHelper.scrollUpMobileElement(AppiumDriver driver, MobileElement element, int duration) - duration not less than 500ms
319+
DriverHelper.zoomInOutPage(WebDriver driver, int zoomPercent) - zoom In/Out the page
319320

320321
DriverHelper.hideKeyboard(AppiumDriver driver) - super method that perform hiding of keyboard for Android and iOS
321322

src/main/java/util/driver/DriverHelper.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,13 @@ public static void scrollUpMobileElement(AppiumDriver driver, MobileElement elem
102102
LOG.info("Scroll up element " + element.getId());
103103
}
104104

105+
public static void zoomInOutPage(WebDriver driver, int zoomPercent) {
106+
if (zoomPercent > 0) {
107+
JavascriptExecutor jse = (JavascriptExecutor) driver;
108+
jse.executeScript("document.body.style.zoom = '" + zoomPercent + "%'");
109+
}
110+
}
111+
105112
public static void wait(int seconds) throws InterruptedException {
106113
sleep(1000 * seconds);
107114
}
@@ -135,7 +142,7 @@ public static void hideKeyboard(AppiumDriver driver) {
135142
try {
136143
driver.hideKeyboard();
137144
driver.hideKeyboard();
138-
}catch (Exception e){
145+
} catch (Exception e) {
139146
LOG.error("Cannot hide a keyboard: " + e.getMessage());
140147
}
141148
}

0 commit comments

Comments
 (0)