Skip to content

Instantly share code, notes, and snippets.

@codyc4321
Created December 24, 2015 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codyc4321/f4c03c0606c2e3e4ff5b to your computer and use it in GitHub Desktop.
Save codyc4321/f4c03c0606c2e3e4ff5b to your computer and use it in GitHub Desktop.
def activate_hidden_element(html_id=None, html_name=None, driver=None):
action = webdriver.ActionChains(driver)
if html_id:
element = driver.find_element_by_id(html_id)
elif html_name:
element = driver.find_element_by_name(html_name)
action.move_to_element(element).click().perform()
return element
# works, but nothing else does
activate_hidden_element(html_id="panel_css", driver=driver)
# pyperclip.paste() doesn't work
# blows up ElementNotVisibleException: Message: Element is not currently visible...
find_box_and_fill(html_id="id_code_css", value="test", driver=driver)
# blows up ElementNotVisibleException: Message: Element is not currently visible...
activate_hidden_element(html_id="id_code_css", driver=driver)
# blows up WebDriverException: Message: $(...) is null
driver.execute_script('$("#panel_css").click();')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment