Skip to content

Instantly share code, notes, and snippets.

@storenth
Forked from rinchik/SeleniumClicks.py
Created May 12, 2018 13:38
Show Gist options
  • Save storenth/5f247463f64ec04bbd3c5306808cb4b8 to your computer and use it in GitHub Desktop.
Save storenth/5f247463f64ec04bbd3c5306808cb4b8 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