attempted fix for msedge driver
This commit is contained in:
parent
0f8388e08c
commit
c33ed44780
@ -26,8 +26,10 @@ jobs:
|
||||
run: |
|
||||
wget https://msedgedriver.azureedge.net/${EDGEDRIVER_VERSION}/edgedriver_win64.zip
|
||||
unzip edgedriver_win64.zip
|
||||
mv msedgedriver drivers
|
||||
|
||||
- name: Run the pytests
|
||||
run: pytest -c pytest.ini
|
||||
run: pytest -c pytest.ini -m edge
|
||||
|
||||
- name: Run the behave tests
|
||||
run: behave
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@
|
||||
.idea/
|
||||
.vscode/
|
||||
.venv/
|
||||
drivers/
|
@ -1,8 +1,13 @@
|
||||
# pylint: disable=too-few-public-methods
|
||||
import platform
|
||||
|
||||
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
|
||||
from selenium.webdriver.edge.service import Service as EdgeService
|
||||
from conftest import CWD
|
||||
import os
|
||||
|
||||
|
||||
class BrowserDriver:
|
||||
@ -35,12 +40,17 @@ def firefox(headless=True):
|
||||
|
||||
def edge(headless=True):
|
||||
options = EdgeOptions()
|
||||
driver_name = "msedgedriver"
|
||||
if platform.system() == 'Windows':
|
||||
driver_name += ".exe"
|
||||
edgedriver_loc = os.path.join(CWD, 'drivers', driver_name)
|
||||
|
||||
options.use_chromium = True
|
||||
options.add_argument('disable-gpu')
|
||||
if headless:
|
||||
options.add_argument('headless')
|
||||
edge_driver = webdriver.Edge(options=options)
|
||||
print(edge_driver.service.path)
|
||||
edge_service = EdgeService(executable_path=edgedriver_loc)
|
||||
edge_driver = webdriver.Edge(service=edge_service, options=options)
|
||||
return edge_driver
|
||||
|
||||
|
||||
|
BIN
edgedriver_win64.zip
Normal file
BIN
edgedriver_win64.zip
Normal file
Binary file not shown.
@ -1,3 +1,7 @@
|
||||
[pytest]
|
||||
addopts = -s
|
||||
testpaths = pytests
|
||||
|
||||
markers =
|
||||
chrome: chrome tests only.
|
||||
firefox: firefox tests only.
|
||||
edge: msedge tests only.
|
||||
|
@ -1,8 +1,10 @@
|
||||
import pytest
|
||||
|
||||
from browserdriver import BrowserDriver
|
||||
from conftest import CWD
|
||||
|
||||
|
||||
@pytest.mark.firefox
|
||||
def test_firefox_browser(headless):
|
||||
bd = BrowserDriver().get("firefox", headless=headless)
|
||||
bd.get('https://test.io')
|
||||
@ -10,6 +12,7 @@ def test_firefox_browser(headless):
|
||||
bd.quit()
|
||||
|
||||
|
||||
@pytest.mark.chrome
|
||||
def test_chrome_browser(headless):
|
||||
bd = BrowserDriver().get("chrome", headless=headless)
|
||||
bd.get('https://test.io')
|
||||
@ -25,8 +28,10 @@ def test_safari_browser():
|
||||
bd.quit()
|
||||
|
||||
|
||||
@pytest.mark.edge
|
||||
def test_edge_browser(headless):
|
||||
bd = BrowserDriver().get("edge", headless=headless)
|
||||
bd.get('https://test.io')
|
||||
assert bd.title == "Home | Test IO"
|
||||
bd.quit()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user