The following code executes up to the point of the first screen capture. After the first screen capture, the script should click the "next" button to request the next page of results be generated. The script is running without errors, but the page is not regenerating (suggesting element is not found or click event is not occurring on the found element), then the 2nd screen shot is taken but is the same screen as the first screen shot. Trying xpath rather than css selector has the same result.
Am I using the find element and click event incorrectly?
setwd("~/R/prsrls/gnb/files/blog")
library(RSelenium)
eCaps <- list(chromeOptions = list(
args = c('--headless', '--disable-gpu', '--window-size=1280,800')
))
rD <- rsDriver(extraCapabilities = eCaps)
#> checking Selenium Server versions:
#> BEGIN: PREDOWNLOAD
#> BEGIN: DOWNLOAD
#> BEGIN: POSTDOWNLOAD
#> checking chromedriver versions:
#> BEGIN: PREDOWNLOAD
#> BEGIN: DOWNLOAD
#> BEGIN: POSTDOWNLOAD
#> checking geckodriver versions:
#> BEGIN: PREDOWNLOAD
#> BEGIN: DOWNLOAD
#> BEGIN: POSTDOWNLOAD
#> checking phantomjs versions:
#> BEGIN: PREDOWNLOAD
#> BEGIN: DOWNLOAD
#> BEGIN: POSTDOWNLOAD
#> [1] "Connecting to remote server"
#> $acceptInsecureCerts
#> [1] FALSE
#>
#> $acceptSslCerts
#> [1] FALSE
#>
#> $applicationCacheEnabled
#> [1] FALSE
#>
#> $browserConnectionEnabled
#> [1] FALSE
#>
#> $browserName
#> [1] "chrome"
#>
#> $chrome
#> $chrome$chromedriverVersion
#> [1] "73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72)"
#>
#> $chrome$userDataDir
#> [1] "/tmp/.com.google.Chrome.HaXd2d"
#>
#>
#> $cssSelectorsEnabled
#> [1] TRUE
#>
#> $databaseEnabled
#> [1] FALSE
#>
#> $`goog:chromeOptions`
#> $`goog:chromeOptions`$debuggerAddress
#> [1] "localhost:45757"
#>
#>
#> $handlesAlerts
#> [1] TRUE
#>
#> $hasTouchScreen
#> [1] FALSE
#>
#> $javascriptEnabled
#> [1] TRUE
#>
#> $locationContextEnabled
#> [1] TRUE
#>
#> $mobileEmulationEnabled
#> [1] FALSE
#>
#> $nativeEvents
#> [1] TRUE
#>
#> $networkConnectionEnabled
#> [1] FALSE
#>
#> $pageLoadStrategy
#> [1] "normal"
#>
#> $platform
#> [1] "Linux"
#>
#> $proxy
#> named list()
#>
#> $rotatable
#> [1] FALSE
#>
#> $setWindowRect
#> [1] TRUE
#>
#> $strictFileInteractability
#> [1] FALSE
#>
#> $takesHeapSnapshot
#> [1] TRUE
#>
#> $takesScreenshot
#> [1] TRUE
#>
#> $timeouts
#> $timeouts$implicit
#> [1] 0
#>
#> $timeouts$pageLoad
#> [1] 300000
#>
#> $timeouts$script
#> [1] 30000
#>
#>
#> $unexpectedAlertBehaviour
#> [1] "ignore"
#>
#> $version
#> [1] "72.0.3626.121"
#>
#> $webStorageEnabled
#> [1] TRUE
#>
#> $webdriver.remote.sessionid
#> [1] "df7a92079c1a5747c37a47a8cf0c540f"
#>
#> $id
#> [1] "df7a92079c1a5747c37a47a8cf0c540f"
remDr <- rD$client
remDr$navigate("https://archive.news.gov.bc.ca/Default.aspx?archive=2013-2017")
remDr$screenshot(display = TRUE)
remDr$findElement("css","#ContentPlaceHolder1_btnNextPage")
remDr$click()
remDr$screenshot(display = TRUE)
# cleanup
rm(rD)
gc()
#> used (Mb) gc trigger (Mb) max used (Mb)
#> Ncells 665833 35.6 1168576 62.5 940480 50.3
#> Vcells 1178930 9.0 1870516 14.3 1650493 12.6
Created on 2019-03-08 by the reprex package (v0.2.1.9000)