def move_to(self, selector, click=False):
'''
Move to the element matched by selector or passed as argument.
Parameters
----------
selector: str
Any valid CSS selector
click: bool
Whether or not to click the element after hovering
defaults to False
'''
try:
elem = self.get_element(selector)
action = webdriver.ActionChains(self.browser)
action.move_to_element(elem)
if click:
action.click(elem)
action.perform()
except WebDriverException:
print("move_to isn't supported with this browser driver.")
评论列表
文章目录