2021-05-01 06:14:51 +08:00
|
|
|
from seleniumbase import BaseCase
|
|
|
|
|
|
|
|
|
|
|
|
class ChromedriverTests(BaseCase):
|
|
|
|
def test_fail_if_using_an_old_chromedriver(self):
|
2021-08-24 08:25:57 +08:00
|
|
|
self.open("data:,")
|
2021-05-01 06:14:51 +08:00
|
|
|
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()
|
2021-05-04 10:39:14 +08:00
|
|
|
major_chrome_version = chrome_version.split(".")[0]
|
2021-05-01 06:14:51 +08:00
|
|
|
chromedriver_version = self.get_chromedriver_version()
|
2021-05-04 10:39:14 +08:00
|
|
|
major_chromedriver_version = chromedriver_version.split(".")[0]
|
2021-05-01 06:14:51 +08:00
|
|
|
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'
|
2021-05-04 10:39:14 +08:00
|
|
|
"You should upgrade chromedriver "
|
2021-05-01 06:14:51 +08:00
|
|
|
"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
|