Skip to content

Instantly share code, notes, and snippets.

@rinchik
Last active June 26, 2018 09:48
Show Gist options
  • Save rinchik/85b5a22b9a342e09edfc6f330f1e072d to your computer and use it in GitHub Desktop.
Save rinchik/85b5a22b9a342e09edfc6f330f1e072d to your computer and use it in GitHub Desktop.
Double-click + click in Python Selenium for rich tables editing
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
def enter_hours(self, cell, amount):
#Double-click
actions = ActionChains(self.driver)
actions.move_to_element(cell)
actions.double_click(cell)
actions.perform()
#Click
cell.click()
#Now, when floating input is visible, grab it and use it!
control = self.driver.find_element_by_css_selector('.grid-editbox')
control.send_keys(amount)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment