Can I use Selenium Python to draw on a canvas?
There is a click_and_hold function as well. This worked for me:
from selenium.webdriver.common.action_chains import ActionChainscanvas = self.driver.find_element_by_id("myCanvas")drawing = ActionChains(self.driver)\ .click_and_hold(canvas)\ .move_by_offset(-10, -15)\ .move_by_offset(20, 32)\ .move_by_offset(10, 25)\ .release()drawing.perform()
(Where self.driver is my Selenium webdriver.)
Maybe I should read a little more of the docs before asking my questions. There are several ActionChains
that could be used to shoehorn the needed testing, such as: