Skip to content

Commit 5100714

Browse files
upd logic
1 parent b7af605 commit 5100714

File tree

5 files changed

+33
-37
lines changed

5 files changed

+33
-37
lines changed

app/selenium_ui/base_page.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,14 @@ def __wait_until(self, expected_condition, locator, time_out=timeout):
134134

135135
def dismiss_popup(self, popup_selectors):
136136
for selector_type, selector_value in popup_selectors:
137-
if selector_type.lower() == "css":
138-
if self.driver.find_elements(by=By.CSS_SELECTOR, value=selector_value):
139-
try:
137+
if self.driver.find_elements(by=selector_type, value=selector_value):
138+
try:
139+
if selector_type == By.CSS_SELECTOR:
140140
self.driver.execute_script(f"document.querySelector('{selector_value}').click()")
141-
except (WebDriverException, Exception):
142-
pass
143-
elif selector_type.lower() == "xpath":
144-
if self.driver.find_elements(by=By.XPATH, value=selector_value):
145-
try:
146-
self.driver.find_element(by=By.XPATH, value=selector_value).click()
147-
except (WebDriverException, Exception):
148-
pass
141+
elif selector_type == By.XPATH:
142+
self.driver.find_element(by=selector_type, value=selector_value).click()
143+
except (WebDriverException, Exception):
144+
pass
149145

150146
def return_to_parent_frame(self):
151147
return self.driver.switch_to.parent_frame()

app/selenium_ui/bitbucket/pages/selectors.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ def projects_url(self):
7676

7777
class PopupLocators:
7878
popup_selectors = [
79-
("css", ".feature-discovery-close"),
80-
("css", ".css-1it7f5o"),
81-
("css", "button.aui-button-link.feature-discovery-close"),
82-
("css", ".css-15p34h1"),
83-
("css", ".css-1dqf51u"),
84-
("css", ".css-1kflcxk"),
85-
("css", ".css-1gh2dqy"),
86-
("css", "[data-testid='whats-new-modal'] button[aria-label='Close modal'] > span > span[aria-hidden='true']")
79+
(By.CSS_SELECTOR, ".feature-discovery-close"),
80+
(By.CSS_SELECTOR, ".css-1it7f5o"),
81+
(By.CSS_SELECTOR, "button.aui-button-link.feature-discovery-close"),
82+
(By.CSS_SELECTOR, ".css-15p34h1"),
83+
(By.CSS_SELECTOR, ".css-1dqf51u"),
84+
(By.CSS_SELECTOR, ".css-1kflcxk"),
85+
(By.CSS_SELECTOR, ".css-1gh2dqy"),
86+
(By.CSS_SELECTOR, "[data-testid='whats-new-modal'] button[aria-label='Close modal'] > span > span[aria-hidden='true']")
8787
]
8888

8989

app/selenium_ui/confluence/pages/selectors.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ def logout_url(self):
3030

3131
class PopupLocators:
3232
popup_selectors = [
33-
("css", ".button-panel-button .set-timezone-button"),
34-
("css", ".aui-button aui-button-link .skip-onboarding"),
35-
("css", ".aui-button.aui-button-link.skip-onboarding"),
36-
("css", "#closeDisDialog"),
37-
("css", ".aui-button.aui-button-primary.show-onboarding"),
38-
("css", "button[aria-label='Close this modal']")
33+
(By.CSS_SELECTOR, ".button-panel-button .set-timezone-button"),
34+
(By.CSS_SELECTOR, ".aui-button aui-button-link .skip-onboarding"),
35+
(By.CSS_SELECTOR, ".aui-button.aui-button-link.skip-onboarding"),
36+
(By.CSS_SELECTOR, "#closeDisDialog"),
37+
(By.CSS_SELECTOR, ".aui-button.aui-button-primary.show-onboarding"),
38+
(By.CSS_SELECTOR, "button[aria-label='Close this modal']")
3939
]
4040

4141

app/selenium_ui/jira/pages/selectors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
class PopupLocators:
66
popup_selectors = [
7-
("css", ".aui-message .icon-close"),
8-
("css", "form.tip-footer>.helptip-close"),
9-
("css", ".aui-inline-dialog-contents .cancel")
7+
(By.CSS_SELECTOR, ".aui-message .icon-close"),
8+
(By.CSS_SELECTOR, "form.tip-footer>.helptip-close"),
9+
(By.CSS_SELECTOR, ".aui-inline-dialog-contents .cancel")
1010
]
1111

1212

app/selenium_ui/jsm/pages/agent_selectors.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
class PopupLocators:
66
popup_selectors = [
7-
("css", ".aui-message .icon-close"),
8-
("css", "form.tip-footer>.helptip-close"),
9-
("css", ".aui-inline-dialog-contents .cancel"),
10-
("css", ".aui-close-button"),
11-
("css", ".aui-button aui-button-link"),
12-
("css", ".buttons-container > div > a"),
13-
("css", ".css-19r5em7"),
14-
("css", ".css-178ag6o"),
15-
("xpath", "//button[contains(text(),'Got it')]")
7+
(By.CSS_SELECTOR, ".aui-message .icon-close"),
8+
(By.CSS_SELECTOR, "form.tip-footer>.helptip-close"),
9+
(By.CSS_SELECTOR, ".aui-inline-dialog-contents .cancel"),
10+
(By.CSS_SELECTOR, ".aui-close-button"),
11+
(By.CSS_SELECTOR, ".aui-button aui-button-link"),
12+
(By.CSS_SELECTOR, ".buttons-container > div > a"),
13+
(By.CSS_SELECTOR, ".css-19r5em7"),
14+
(By.CSS_SELECTOR, ".css-178ag6o"),
15+
(By.XPATH, "//button[contains(text(),'Got it')]")
1616
]
1717

1818

0 commit comments

Comments
 (0)