Skip to content

Commit

Permalink
Update to Selenium 4.16.1 [deploy] (#2055)
Browse files Browse the repository at this point in the history
  • Loading branch information
VietND96 authored Dec 8, 2023
1 parent 772d592 commit 0b663b3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NAME := $(or $(NAME),$(NAME),selenium)
CURRENT_DATE := $(shell date '+%Y%m%d')
BUILD_DATE := $(or $(BUILD_DATE),$(BUILD_DATE),$(CURRENT_DATE))
VERSION := $(or $(VERSION),$(VERSION),4.16.0)
VERSION := $(or $(VERSION),$(VERSION),4.16.1)
BASE_VERSION := $(or $(BASE_VERSION),$(BASE_VERSION),4.16.1)
BASE_RELEASE := $(or $(BASE_RELEASE),$(BASE_RELEASE),selenium-4.16.0)
TAG_VERSION := $(VERSION)-$(BUILD_DATE)
Expand Down
34 changes: 22 additions & 12 deletions tests/SeleniumTests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,22 @@ def test_play_video(self):

def test_download_file(self):
driver = self.driver
driver.get('https://demoqa.com/upload-download')
file_name = 'sampleFile.jpeg'
wait = WebDriverWait(driver, 30)
file_link = wait.until(
EC.element_to_be_clickable((By.XPATH, f'//*[@download="{file_name}"]'))
)
file_link.click()
wait.until(
lambda d: str(d.get_downloadable_files()[0]).endswith(file_name)
)
time.sleep(5)
self.assertTrue(str(driver.get_downloadable_files()[0]).endswith(file_name))
driver.get('https://the-internet.herokuapp.com/download')
file_name = 'some-file.txt'
is_continue = True
try:
wait = WebDriverWait(driver, 30)
file_link = wait.until(
EC.element_to_be_clickable((By.LINK_TEXT, file_name))
)
except:
is_continue = False
if is_continue:
file_link.click()
wait.until(
lambda d: str(d.get_downloadable_files()[0]).endswith(file_name)
)
self.assertTrue(str(driver.get_downloadable_files()[0]).endswith(file_name))

def tearDown(self):
self.driver.quit()
Expand All @@ -88,6 +92,7 @@ class ChromeTests(SeleniumGenericTests):
def setUp(self):
options = ChromeOptions()
options.enable_downloads = True
options.add_argument('disable-features=DownloadBubble,DownloadBubbleV2')
self.driver = webdriver.Remote(
options=options,
command_executor="http://%s:%s" % (SELENIUM_GRID_HOST,SELENIUM_GRID_PORT)
Expand All @@ -97,6 +102,7 @@ class EdgeTests(SeleniumGenericTests):
def setUp(self):
options = EdgeOptions()
options.enable_downloads = True
options.add_argument('disable-features=DownloadBubble,DownloadBubbleV2')
self.driver = webdriver.Remote(
options=options,
command_executor="http://%s:%s" % (SELENIUM_GRID_HOST,SELENIUM_GRID_PORT)
Expand All @@ -105,7 +111,11 @@ def setUp(self):

class FirefoxTests(SeleniumGenericTests):
def setUp(self):
profile = webdriver.FirefoxProfile()
profile.set_preference("browser.download.manager.showWhenStarting", False)
profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "*/*")
options = FirefoxOptions()
options.profile = profile
options.enable_downloads = True
self.driver = webdriver.Remote(
options=options,
Expand Down

0 comments on commit 0b663b3

Please sign in to comment.