Skip to content

Instantly share code, notes, and snippets.

@SubhadityaMukherjee
Created February 9, 2022 10:11
Show Gist options
  • Save SubhadityaMukherjee/334a1b229efd12b4165ca77b53de83b6 to your computer and use it in GitHub Desktop.
Save SubhadityaMukherjee/334a1b229efd12b4165ca77b53de83b6 to your computer and use it in GitHub Desktop.
browsers
if browser.lower() == "chrome":
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.options import Options
opts = Options()
browser = Chrome(options=opts)
elif browser.lower() == "firefox":
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
opts = Options()
browser = Firefox(options=opts)
def repeat_keys(actions, key, repeat=2):
"""
Repeats a key "repeat" number of times
"""
for _ in range(repeat):
actions.send_keys(key)
def chain_actions(actions, list_of):
"""
Executes a chain of actions passed in a list sequentially
"""
for i in list_of:
actions.send_keys(i)
actions.perform()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment