Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit 9f6838d

Browse files
authored
Merge pull request #15 from hetznercloud/14-add-new-helper-window-scroll-bottom
14 add new helper window scroll bottom
2 parents 6bdde86 + 5a624ac commit 9f6838d

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,17 @@ Opens the passed URL in a new tab.
573573

574574
**Returns:** `Promise`<`Promise`<`boolean`>>
575575

576+
___
577+
<a id="scrollbottom"></a>
578+
579+
#### scrollBottom
580+
581+
**scrollBottom**(): `Promise`<`void`>
582+
583+
Scrolls to the bottom of the window.
584+
585+
**Returns:** `Promise`<`void`>
586+
576587
___
577588
<a id="scrolltop"></a>
578589

dist/window.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import * as webdriver from 'selenium-webdriver';
33
* Scrolls to the top of the window.
44
*/
55
export declare function scrollTop(): webdriver.promise.Promise<void>;
6+
/**
7+
* Scrolls to the bottom of the window.
8+
*/
9+
export declare function scrollBottom(): webdriver.promise.Promise<void>;
610
/**
711
* Closes a browser window, popup, or tab identified by its zero-based index.
812
* If two windows are open and the second window is to be closed, the index

dist/window.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ function scrollTop() {
1515
return protractor_1.browser.executeScript('window.scrollTo(0,0);');
1616
}
1717
exports.scrollTop = scrollTop;
18+
/**
19+
* Scrolls to the bottom of the window.
20+
*/
21+
function scrollBottom() {
22+
return protractor_1.browser.executeScript('window.scrollTo(0, document.body.scrollHeight);');
23+
}
24+
exports.scrollBottom = scrollBottom;
1825
/**
1926
* Closes a browser window, popup, or tab identified by its zero-based index.
2027
* If two windows are open and the second window is to be closed, the index

lib/window.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ export function scrollTop(): webdriver.promise.Promise<void> {
1515
return browser.executeScript('window.scrollTo(0,0);');
1616
}
1717

18+
/**
19+
* Scrolls to the bottom of the window.
20+
*/
21+
export function scrollBottom(): webdriver.promise.Promise<void> {
22+
return browser.executeScript(
23+
'window.scrollTo(0, document.body.scrollHeight);'
24+
);
25+
}
26+
1827
/**
1928
* Closes a browser window, popup, or tab identified by its zero-based index.
2029
* If two windows are open and the second window is to be closed, the index

0 commit comments

Comments
 (0)