Add a test that fails if using an old version of chromedriver

This commit is contained in:
Michael Mintz 2021-04-30 18:14:51 -04:00
parent bbfc588e30
commit dc3ee95136
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
from seleniumbase import BaseCase
class ChromedriverTests(BaseCase):
def test_fail_if_using_an_old_chromedriver(self):
if self.browser != "chrome":
print("\n This test is only for Chrome!")
print(" (Run with: '--browser=chrome')")
self.skip("This test is only for Chrome!")
chrome_version = self.get_chrome_version()
major_chrome_version = chrome_version.split('.')[0]
chromedriver_version = self.get_chromedriver_version()
major_chromedriver_version = chromedriver_version.split('.')[0]
install_sb = "sbase install chromedriver %s" % major_chrome_version
if (
int(major_chromedriver_version) < 73
and int(major_chrome_version) >= 73
):
message = (
'Your version of chromedriver: "%s"\n '
'is too old for your version of Chrome: "%s"\n'
'You should upgrade chromedriver '
"to receive important bug fixes!\n"
'Run this command to upgrade: "%s"'
% (chromedriver_version, chrome_version, install_sb)
)
raise Exception(message) # chromedriver is out-of-date