0

the website i am using

i want to use selenium to scroll down this web page, however the website is split into two screens which left side is a list of result, right side is a map.

In order to scroll left side down to bottom, the cursor have to be within result area.

So i tried perform() here, the xpath is pointing to one of the result, but it is not working:

hover = ActionChains(driver);
Elem_to_hover = driver.find_element_by_xpath("""//*[@id="js-map-search-result-list"]/li[1]/p/a/img""");
hover.move_to_element(Elem_to_hover);
hover.perform();

So selenium is not able to use perform() when there are multiple same elements in the page?

Then i tried to use the xpath pointing to the result display area, but still not working

hover = ActionChains(driver);
Elem_to_hover = driver.find_element_by_xpath("""//*[@id="js-map-search-result-list"]""");
hover.move_to_element(Elem_to_hover);
hover.perform();
icantcode
  • 142
  • 1
  • 15

1 Answers1

1

You can try,

driver.findElement(By.id("js-item-count-upside")).click();
WebElement element = driver.findElement(By.xpath("//*[@id='js-map-search-result-list']/li[1]/p/a/img"));
driver.executeScript("arguments[0].scrollIntoView()", element);