-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.py
More file actions
38 lines (29 loc) · 941 Bytes
/
base.py
File metadata and controls
38 lines (29 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
Base page module providing common functionality for all page objects.
"""
class BasePage:
"""Base class for all page objects with common methods."""
def __init__(self, page):
"""
Initialize the BasePage with a Playwright page instance.
Args:
page: Playwright page object
"""
self.page = page
def scroll_into_view(self, locator):
"""
Scroll the last element matching the locator into view.
Args:
locator: Playwright locator object
"""
reference_list = locator
locator.nth(reference_list.count() - 1).scroll_into_view_if_needed()
def is_visible(self, locator):
"""
Check if an element is visible on the page.
Args:
locator: Playwright locator object
Returns:
bool: True if visible, False otherwise
"""
return locator.is_visible()