5

I am trying to web scrape the data from the Flipkart site. The link for the webpage is as follows: https://www.flipkart.com/mi-a1-black-64-gb/product-reviews/itmexnsrtzhbbneg?aid=overall&pid=MOBEX9WXUSZVYHET

I need to automate navigation to the NEXT page by clicking on NEXT button the webpage. Below is the code I'm using

nextButton <-remDr$findElement(value ='//div[@class="_2kUstJ"]')$clickElement()

Error

Selenium message:Element is not clickable at point

I even tried scrolling the webpage as suggested by many stackoverflow questions using the below code

remDr$executeScript("arguments[0].scrollIntoView(true);", nextButton)

But this code is also giving error as

 Error in checkError(res) : Undefined error in httr call. httr output: No method for S4 class:webElement 

Kindly suggest the solution. I'm using firefox browser and selenium to automate using R programming.

Jaap
  • 71,900
  • 30
  • 164
  • 175
Sana Ansari
  • 111
  • 4

1 Answers1

0

If you do not mind using Chrome driver, the following code worked:

eCaps <- list(chromeOptions = list(
  args = c('--headless', '--disable-gpu', '--window-size=1880,1000',  "--no-sandbox", "--disable-dev-shm-usage")
))

remDr <- rsDriver(port = 4565L,browser = "chrome",extraCapabilities = eCaps)
remCl <- remDr[["client"]]

remCl$navigate("https://www.flipkart.com/mi-a1-black-64-gb/product-reviews/itmexnsrtzhbbneg?aid=overall&pid=MOBEX9WXUSZVYHET")

remCl$findElement(using = "css selector", "._3fVaIS > span:nth-child(1)")$clickElement()
Unheilig
  • 15,690
  • 193
  • 65
  • 96
andrein
  • 61
  • 3