Created
February 9, 2022 10:11
-
-
Save SubhadityaMukherjee/334a1b229efd12b4165ca77b53de83b6 to your computer and use it in GitHub Desktop.
browsers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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