Created
January 3, 2020 11:29
-
-
Save eirenik0/4183a11a901f488d1bdbb4d7b1f7a859 to your computer and use it in GitHub Desktop.
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
def css_selector_from_(by, value): | |
if by == By.ID: | |
value = "#%s" % value | |
elif by == By.CLASS_NAME: | |
value = ".%s" % value | |
elif by == By.NAME: | |
value = '[name="%s"]' % value | |
elif by in [By.XPATH, By.CSS_SELECTOR, By.TAG_NAME]: | |
value = value | |
else: | |
raise TypeError("By {} is not supported".format(by)) | |
return value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment