From e5404357f9b4f21a4eef00a8f0e215bff5890585 Mon Sep 17 00:00:00 2001 From: liyang Date: Sat, 11 May 2024 10:52:14 +0800 Subject: [PATCH] + Add scroll page method. --- test/lib/webdriver/webdriver.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/lib/webdriver/webdriver.class.php b/test/lib/webdriver/webdriver.class.php index cc699c5a75..245f92b416 100644 --- a/test/lib/webdriver/webdriver.class.php +++ b/test/lib/webdriver/webdriver.class.php @@ -324,6 +324,18 @@ class webdriver return $this; } + /** + * Scroll page, default distance is 100 px. + * + * @param int $scrollDistance + * @access public + * @return void + */ + public function scroll($scrollDistance = 100) + { + $this->driver->executeScript("window.scrollBy(0, $scrollDistance);"); + return $this; + } } class dom