user2547656
user2547656

Reputation: 61

clickAndHold is not working in Selenium webdriver (python)

I have a function with actions like click, focus, etc. and works fine, but I need the function clickAndHold and returns an error when I try to run test.

This is a piece of code of my function:

def start_action(self, selector, action, value):
browser = self.d
element = browser.find_element_by_xpath(selector)
if action == 'clickAndHold':
        actions = ActionChains(browser)
        actions.clickAndHold(element)
        actions.perform()

And this is the error:

AttributeError: 'ActionChains' object has no attribute 'clickAndHold'

Please help me!

Upvotes: 2

Views: 602

Answers (1)

Andersson
Andersson

Reputation: 52685

In Python this method called click_and_hold(). Try to use it instead of clickAndHold()

Note that in Python in most cases snake_case used instead of camelCase

Upvotes: 1

Related Questions