Created
February 12, 2019 08:30
-
-
Save alberand/fbdd90b68ff4d4c93150041579318a2d to your computer and use it in GitHub Desktop.
Selenium sandbox
This file contains 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
# -*- coding: utf-8 -*- | |
import time | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.chrome.options import Options | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.support.ui import Select | |
from selenium.webdriver.support.ui import WebDriverWait | |
DRIVERS_PATH = r'C:\UserData\user\Documents\Projects\drivers' | |
opts = Options() | |
opts.add_experimental_option("useAutomationExtension", False) | |
opts.add_argument('--incognito') | |
opts.add_argument('--log-level=3') | |
DRIVER = 'chrome' | |
TIMEOUT = 30 | |
if DRIVER == 'chrome': | |
driver = webdriver.Chrome(options=opts, executable_path=DRIVERS_PATH+'\\chromedriver.exe') | |
if DRIVER == 'firefox': | |
driver = webdriver.Firefox(executable_path=DRIVERS_PATH+'\\geckodriver.exe') | |
if DRIVER == 'ie': | |
driver = webdriver.Ie(executable_path=DRIVERS_PATH+'\\IEDriverServer.exe') | |
if DRIVER == 'edge': | |
driver = webdriver.Edge(executable_path=DRIVERS_PATH+'\\MicrosoftWebDriver.exe') | |
driver.get("http://127.0.0.1/index.html") | |
# %% | |
# %% | |
driver.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment