Use Webdriver Manager for browser compatibility
Version mismatch between browser and selenium driver breaks the tests. The Webdriver manager automatically ensures the compatibility by downloading the right driver for the installed browser.
This commit is contained in:
parent
c9b665b464
commit
1abf455711
3
.gitignore
vendored
3
.gitignore
vendored
@ -9,6 +9,9 @@ env/
|
||||
# IntelliJ project files
|
||||
.idea
|
||||
|
||||
# Webdriver Manager: cache for selenium drivers
|
||||
.wdm
|
||||
|
||||
# Generated (compiled) JavaScript code
|
||||
__target__/
|
||||
OOMAnalyser.js
|
1
Makefile
1
Makefile
@ -39,6 +39,7 @@ clean:
|
||||
@find $(BASE_DIR) -depth -type f -name "*.pyo" -exec rm -f {} \;
|
||||
@find $(BASE_DIR) -depth -type f -name "*.orig" -exec rm -f {} \;
|
||||
@find $(BASE_DIR) -depth -type f -name "*~" -exec rm -f {} \;
|
||||
@$(RM) --force --recursive .wdm
|
||||
@$(RM) --force --recursive __target__
|
||||
|
||||
#+ Remove all automatically generated and Git repository data
|
||||
|
@ -1,2 +1,3 @@
|
||||
Transcrypt == 3.7.16
|
||||
selenium
|
||||
webdriver-manager
|
||||
|
9
test.py
9
test.py
@ -24,6 +24,7 @@ import threading
|
||||
import unittest
|
||||
from selenium import webdriver
|
||||
from selenium.common.exceptions import *
|
||||
from webdriver_manager.chrome import ChromeDriverManager
|
||||
import warnings
|
||||
|
||||
import OOMAnalyser
|
||||
@ -84,7 +85,13 @@ class TestInBrowser(TestBase):
|
||||
server_thread.daemon = True
|
||||
server_thread.start()
|
||||
|
||||
self.driver = webdriver.Chrome()
|
||||
# silent Webdriver Manager
|
||||
os.environ['WDM_LOG_LEVEL'] = '0'
|
||||
|
||||
# store driver locally
|
||||
os.environ['WDM_LOCAL'] = '1'
|
||||
|
||||
self.driver = webdriver.Chrome(ChromeDriverManager().install())
|
||||
self.driver.get("http://127.0.0.1:8000/OOMAnalyser.html")
|
||||
|
||||
def tearDown(self):
|
||||
|
Loading…
Reference in New Issue
Block a user