Skip to content

Commit 57491e5

Browse files
Added docstring to the click helper util and changed a print statement to logging instead
1 parent e72d83e commit 57491e5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pages/base_page.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from playwright.sync_api import Page, expect
22
from utils.click_helper import click
3-
3+
import logging
44

55
class BasePage:
66
def __init__(self, page: Page):
@@ -105,6 +105,12 @@ def go_to_screening_subject_search_page(self)->None:
105105
click(self.page, self.screening_subject_search_page)
106106

107107
def click(self, locator) -> None:
108+
"""
109+
This is used to click on a locator
110+
The reason for this being used over the normal playwright click method is due to:
111+
- BCSS sometimes takes a while to render and so the normal click function 'clicks' on a locator before its available
112+
- Increases the reliability of clicks to avoid issues with the normal click method
113+
"""
108114
try:
109115
self.page.wait_for_load_state('load')
110116
self.page.wait_for_load_state('domcontentloaded')
@@ -113,5 +119,5 @@ def click(self, locator) -> None:
113119
locator.click()
114120

115121
except Exception as locatorClickError:
116-
print(f"Failed to click element with error: {locatorClickError}, trying again...")
122+
logging.warning(f"Failed to click element with error: {locatorClickError}, trying again...")
117123
locator.click()

0 commit comments

Comments
 (0)