update driver references for selenium 4
This commit is contained in:
parent
4e3c267656
commit
dbede2bc6a
@ -1,5 +1,8 @@
|
||||
# pylint: disable=too-few-public-methods
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.options import Options as ChromeOptions
|
||||
from selenium.webdriver.firefox.options import Options as FirefoxOptions
|
||||
from selenium.webdriver.edge.options import Options as EdgeOptions
|
||||
|
||||
|
||||
class BrowserDriver:
|
||||
@ -15,26 +18,28 @@ class BrowserDriver:
|
||||
|
||||
|
||||
def chrome(headless=True):
|
||||
options = webdriver.ChromeOptions()
|
||||
options.headless = headless
|
||||
options = ChromeOptions()
|
||||
if headless:
|
||||
options.add_argument("--headless")
|
||||
options.add_argument('--ignore-certificate-errors')
|
||||
return webdriver.Chrome(options=options)
|
||||
|
||||
|
||||
def firefox(headless=True):
|
||||
options = webdriver.FirefoxOptions()
|
||||
options = FirefoxOptions()
|
||||
if headless:
|
||||
options.add_argument("--headless")
|
||||
options.accept_insecure_certs = True
|
||||
options.headless = headless
|
||||
options.add_argument('--ignore-certificate-errors')
|
||||
return webdriver.Firefox(options=options)
|
||||
|
||||
|
||||
def edge(headless=True):
|
||||
options = webdriver.EdgeOptions()
|
||||
options = EdgeOptions()
|
||||
options.use_chromium = True
|
||||
options.headless = headless
|
||||
driver = webdriver.Edge(options=options)
|
||||
return driver
|
||||
options.add_argument('disable-gpu')
|
||||
if headless:
|
||||
options.add_argument('headless')
|
||||
return webdriver.Edge(options=options)
|
||||
|
||||
|
||||
def safari():
|
||||
|
Loading…
Reference in New Issue
Block a user