scitex_browser.interaction

async scitex_browser.interaction.click_center_async(page, verbose=False, func_name='click_center_async')[source]

Click the center of the viewport.

Parameters:
  • page – Playwright page object

  • verbose (bool) – Enable visual feedback (default False)

Returns:

Click result

async scitex_browser.interaction.click_with_fallbacks_async(page, selector, method='auto', verbose=False, capture_debug=True)[source]

Click element using multiple fallback methods.

Parameters:
  • page (Page) – Playwright page object

  • selector (str) – CSS selector for the element

  • method (str) – Click method (“auto”, “playwright”, “force”, “js”)

  • verbose (bool) – Enable visual feedback via popup system (default False)

  • capture_debug (bool) – Save screenshot+HTML before/after the click (default True). Disabled in tight loops or hot paths where artifact volume hurts.

Returns:

True if click successful, False otherwise

Return type:

bool

async scitex_browser.interaction.fill_with_fallbacks_async(page, selector, value, method='auto', verbose=False, capture_debug=True)[source]

Fill element using multiple fallback methods.

Parameters:
  • page (Page) – Playwright page object

  • selector (str) – CSS selector for the element

  • value (str) – Value to fill

  • method (str) – Fill method (“auto”, “playwright”, “type”, “js”)

  • verbose (bool) – Enable visual feedback via popup system (default False)

  • capture_debug (bool) – Save screenshot+HTML before/after the fill (default True). Disabled in tight loops or hot paths.

Returns:

True if fill successful, False otherwise

Return type:

bool

class scitex_browser.interaction.PopupHandler(page)[source]

Bases: object

Handle various types of popups on web pages.

COOKIE_SELECTORS = ['button#onetrust-accept-btn-handler', 'button#onetrust-pc-btn-handler', 'button[id*="accept-cookie"]', 'button[id*="accept-all"]', 'button[aria-label*="accept cookie"]', 'button[aria-label*="Accept cookie"]', 'button:has-text("Accept all")', 'button:has-text("Accept All")', 'button:has-text("I agree")', 'button:has-text("I Agree")', 'button:has-text("Accept")', '.cookie-notice button.accept', '[class*="cookie"] button[class*="accept"]']
CLOSE_SELECTORS = ['button[aria-label="Close"]', 'button[aria-label="close"]', 'button[aria-label*="Close"]', 'button[aria-label*="close"]', 'button[aria-label*="dismiss"]', 'button[aria-label*="Dismiss"]', 'button.close', 'button.close-button', 'button.modal-close', 'button.popup-close', 'button.dialog-close', 'a.close', 'a.close-button', 'span.close', '[class*="close-button"]', '[class*="close-icon"]', 'svg[class*="close"]', 'button:has-text("No thanks")', 'button:has-text("No Thanks")', 'button:has-text("Maybe later")', 'button:has-text("Maybe Later")', 'button:has-text("Skip")', 'button:has-text("Dismiss")', 'button:has-text("Not now")', 'button:has-text("Not Now")']
MODAL_SELECTORS = ['.modal', '.overlay', '[role="dialog"]', '.popup', '#onetrust-banner-sdk', '.onetrust-pc-dark-filter', '[class*="modal"]', '[class*="popup"]', '[class*="overlay"]', '[class*="dialog"]', '[class*="banner"]', 'div[aria-modal="true"]']
__init__(page)[source]

Initialize popup handler with a page.

async detect_popups()[source]

Detect all visible popups on the page.

Return type:

List[Dict]

Returns:

List of detected popups with their details

Handle cookie consent popups.

Return type:

bool

Returns:

True if handled, False otherwise

async close_popup(popup_info=None)[source]

Close a popup using various strategies.

Parameters:

popup_info (Optional[Dict]) – Optional popup information from detect_popups

Return type:

bool

Returns:

True if closed, False otherwise

async handle_all_popups(max_attempts=3, delay_ms=1000)[source]

Detect and handle all popups on the page.

Parameters:
  • max_attempts (int) – Maximum number of attempts to clear popups

  • delay_ms (int) – Delay between attempts in milliseconds

Return type:

int

Returns:

Number of popups handled

async wait_and_handle_popups(timeout_ms=5000)[source]

Wait for popups to appear and handle them.

Parameters:

timeout_ms (int) – Maximum time to wait for popups

Return type:

int

Returns:

Number of popups handled

async scitex_browser.interaction.close_popups_async(page, handle_cookies=True, close_others=True, max_attempts=3, wait_first=True, wait_ms=2000)[source]

Convenience function to handle all popups on a page.

Parameters:
  • page (Page) – Playwright page object

  • handle_cookies (bool) – Whether to accept cookie popups

  • close_others (bool) – Whether to close other popups

  • max_attempts (int) – Maximum attempts to clear popups

  • wait_first (bool) – Whether to wait for popups to appear first

  • wait_ms (int) – Time to wait for popups to appear

Return type:

Tuple[int, List]

Returns:

Tuple of (number handled, list of handled popups)

async scitex_browser.interaction.ensure_no_popups_async(page, check_interval_ms=1000)[source]

Ensure no popups are blocking the page.

Parameters:
  • page (Page) – Playwright page object

  • check_interval_ms (int) – Interval to check for popups

Return type:

bool

Returns:

True if page is clear of popups