I sometimes use ActionsChains with any problems, today he work but stop my program do you know why?
scrolling_bar = driver.find_element(By.CSS_SELECTOR, "#scrolling_bar")
start = scrolling_bar.location
ActionChains(driver)
.drag_and_drop_by_offset(scrolling_bar, start['x'], start['y'] - 1000)
.perform()
print('This message never be said')
ActionChains(driver).reset_actions()
The actions is been execute but stop my program
Laslo Laslo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2
Use an explicit wait to ensure the element is visible before interacting with it.
Try click_and_hold
, move_by_offset
, and release instead of drag_and_drop_by_offset
.
driver = webdriver.Firefox()
driver.get('YOUR_URL_HERE')
scrolling_bar = WebDriverWait(driver, 10).until(
EC.visibility_of_element_located((By.CSS_SELECTOR, "#scrolling_bar"))
)
actions = ActionChains(driver)
actions.click_and_hold(scrolling_bar).move_by_offset(0, -1000).release().perform()
print('Drag and drop performed')
driver.quit()
2
I resolve the problem, -1000 is just to expensive… Thank’s for answering!!
Laslo Laslo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.