4

I am trying to scroll until an element is visible on the page so Selenium can double click the element. If the element is not visible, I keep receiving error

Selenium message:(189, 2887) is out of bounds of viewport width (1600) and height (803)

#Navigating to Webpage for Mechanical Air Conditioner 
url <- "https://www.walmart.com/ip/GE-5-000-BTU-Mechanical-Air-Conditioner-AET05LY/993795463"
rD <- rsDriver(browser = "firefox")
remDr <- rD$client
remDr$open() #Open Browser
#remDr$getStatus
remDr$navigate(url) #Navigate to WalMart Page


#Select See all Reviews
see_all_select_Elem <- remDr$findElement(using = "class name", value = "ReviewsHeader-seeAll") #Find Select All Reviews Button
see_all_select_loc <- remDr$mouseMoveToLocation (webElement = see_all_select_Elem) #Hover mouse over select All Reviews Button
see_all_select <- remDr$doubleclick(buttonId = 'LEFT') #Double Click Select All Reviews Button

How do I get Selenium to scroll until see_all_select_Elem is visible so the double click function works.

Nad Pat
  • 3,129
  • 3
  • 10
  • 20

1 Answers1

0

Instead of scrolling to particular element you can just scroll to the end of the page so that whole page is loaded.

remDr$navigate(url)
#scroll to the end 

webElem <- remDr$findElement("css", "html")
webElem$sendKeysToElement(list(key='end'))
Nad Pat
  • 3,129
  • 3
  • 10
  • 20