0

I know that, sometimes, selenium is not able to click on an element, and in order to do so you need to execute some javascript code. For example, I recently used something like:

button = WebDriverWait(driver,10).until(EC.visibility_of_element_located((By.XPATH,"//label[@for='cli-no']/span[text()='No']")))
driver.execute_script("arguments[0].click();", button)

Can this same thing happen when trying to move a slider(using a dragAndDropByOfsset, for example)? How would you execute such a script?

Also, do you know whether good documentation exists regarding this issue?

Thanks!

martifapa
  • 107
  • 3
  • 12
  • What is a "slider?" `driver.execute_script(...)` is the typical way of executing JS in Python with Selenium. – Josh Clark Apr 08 '20 at 14:31
  • Hi Josh! The only examples I've found of executing a JS in Python clicked an item. What I would like to know is if the same can be done, but with a drag and drop – martifapa Apr 08 '20 at 14:41
  • 1
    Does this answer your question? [How to simulate HTML5 Drag and Drop in Selenium Webdriver?](https://stackoverflow.com/questions/29381233/how-to-simulate-html5-drag-and-drop-in-selenium-webdriver) – Josh Clark Apr 08 '20 at 14:43
  • Do you know whether it will make a difference if I use this instead of drag and drop by offset? If it doesn't then yes, it answers it! – martifapa Apr 08 '20 at 14:47

0 Answers0