Ever wondered how to move the slider from left to right?
Luckily I did some research and tinkering. For this example, the slider found at http://seiyria.com/bootstrap-slider/ will be used.
The most important part here is importing and using the ActionChains library. The ActionChains object will drive the slider by setting an offset value.
move = ActionChains(driver)
move.click_and_hold(slider).move_by_offset(40, 0).release().perform()
Sharing my code here.
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Firefox() driver.get("https://www.seiyria.com/bootstrap-slider")
slider = driver.find_element_by_css_selector("div#example-1 div.slider-handle.min-slider-handle.round")
move = ActionChains(driver)
move.click_and_hold(slider).move_by_offset(40, 0).release().perform()
Try it out and let me know! It’s also on my GitHub.