Search code examples
rselenium

how to move slider using Rselenium?


i am trying to move the slider to the max of 2000 px

driver = rsDriver(browser = c("firefox"))
remDr <- driver[["client"]]
remDr$navigate('https://www.qrcode-monkey.com/#url')

webElem <- remDr$findElement("xpath", "//span[@class='rz-pointer rz-pointer-min']")

i have tried these commands but it is not working

webElem$buttondown(2)
webElem$setElementAttribute("aria-valuetext", 2000)

enter image description here


Solution

  • We can simply click on pointer and press end

    #launch browser
    driver = rsDriver(browser = c("firefox"))
    remDr <- driver[["client"]]
    remDr$navigate('https://www.qrcode-monkey.com/#url')
    
    #click element 
    remDr$findElement(using = "xpath",'/html/body/div[2]/div[2]/div[2]/div/div/div[2]/div[2]/div[1]/div/div[1]/span[5]')$clickElement()
    
    #press end 
    webElem <- remDr$findElement(using = "xpath",'/html/body/div[2]/div[2]/div[2]/div/div/div[2]/div[2]/div[1]/div/div[1]/span[5]')
    webElem$sendKeysToElement(list(key="end"))
    

    enter image description here