Last active
August 29, 2015 14:26
-
-
Save avuori/a19abfdac42b09ad844b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_range(el, val): | |
minval = float(el.get_attribute("min") or 0) | |
maxval = float(el.get_attribute("max") or 100) | |
v = max(0, min(1, (float(val) - minval) / (maxval - minval))) | |
width = el.size["width"] | |
target = float(width) * v | |
ac = ActionChains(driver) | |
ac.move_to_element_with_offset(el, target, 1) | |
ac.click() | |
ac.perform() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment