Compare commits
3 Commits
c1c3fd1f28
...
842ddb4399
Author | SHA1 | Date | |
---|---|---|---|
842ddb4399 | |||
a7ff39f053 | |||
dbede2bc6a |
@ -16,9 +16,6 @@ jobs:
|
|||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
apt search firefox
|
|
||||||
apt search chrom
|
|
||||||
apt search driver
|
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
python -m pip install -r requirements.txt
|
python -m pip install -r requirements.txt
|
||||||
- name: Run the pytests
|
- name: Run the pytests
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
# pylint: disable=too-few-public-methods
|
# pylint: disable=too-few-public-methods
|
||||||
from selenium import webdriver
|
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:
|
class BrowserDriver:
|
||||||
@ -15,26 +18,28 @@ class BrowserDriver:
|
|||||||
|
|
||||||
|
|
||||||
def chrome(headless=True):
|
def chrome(headless=True):
|
||||||
options = webdriver.ChromeOptions()
|
options = ChromeOptions()
|
||||||
options.headless = headless
|
if headless:
|
||||||
|
options.add_argument("--headless")
|
||||||
options.add_argument('--ignore-certificate-errors')
|
options.add_argument('--ignore-certificate-errors')
|
||||||
return webdriver.Chrome(options=options)
|
return webdriver.Chrome(options=options)
|
||||||
|
|
||||||
|
|
||||||
def firefox(headless=True):
|
def firefox(headless=True):
|
||||||
options = webdriver.FirefoxOptions()
|
options = FirefoxOptions()
|
||||||
|
if headless:
|
||||||
|
options.add_argument("--headless")
|
||||||
options.accept_insecure_certs = True
|
options.accept_insecure_certs = True
|
||||||
options.headless = headless
|
|
||||||
options.add_argument('--ignore-certificate-errors')
|
|
||||||
return webdriver.Firefox(options=options)
|
return webdriver.Firefox(options=options)
|
||||||
|
|
||||||
|
|
||||||
def edge(headless=True):
|
def edge(headless=True):
|
||||||
options = webdriver.EdgeOptions()
|
options = EdgeOptions()
|
||||||
options.use_chromium = True
|
options.use_chromium = True
|
||||||
options.headless = headless
|
options.add_argument('disable-gpu')
|
||||||
driver = webdriver.Edge(options=options)
|
if headless:
|
||||||
return driver
|
options.add_argument('headless')
|
||||||
|
return webdriver.Edge(options=options)
|
||||||
|
|
||||||
|
|
||||||
def safari():
|
def safari():
|
||||||
|
Loading…
Reference in New Issue
Block a user