Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to perform a scroll in a drop down list to hidden element?

How to perform a scroll in a drop down list with that format with selenium, appium ? I'm using tag name to identify elements, <md-option .../> are the items in the drop down list. enter image description here

Here is my html code :

enter image description here

like image 436
Emna Ayadi Avatar asked Jun 06 '16 07:06

Emna Ayadi


2 Answers

I have solved it by this way :

// Create instance of Javascript executor
JavascriptExecutor je = (JavascriptExecutor) driver;
//Identify the WebElement which will appear after scrolling down
WebElement element = driver.findElement(By.tagName("...."));
// now execute query which actually will scroll until that element is not appeared on page.
je.executeScript("arguments[0].scrollIntoView(true);",element);
like image 130
Emna Ayadi Avatar answered Nov 15 '22 09:11

Emna Ayadi


Try following code.

browser.executeScript('window.scrollTo(0,0);').then(function () {
    page.saveButton.click();
})

Hope this helps. :)

like image 23
Manuli Avatar answered Nov 15 '22 10:11

Manuli