diff --git a/scrapling/engines/camo.py b/scrapling/engines/camo.py index 5d22aa5..1eb9976 100644 --- a/scrapling/engines/camo.py +++ b/scrapling/engines/camo.py @@ -64,11 +64,14 @@ class CamoufoxEngine: self.addons = addons or [] self.humanize = humanize self.timeout = check_type_validity(timeout, [int, float], 30000) - if callable(page_action): - self.page_action = page_action + if page_action is not None: + if callable(page_action): + self.page_action = page_action + else: + self.page_action = None + log.error('[Ignored] Argument "page_action" must be callable') else: self.page_action = None - log.error('[Ignored] Argument "page_action" must be callable') self.wait_selector = wait_selector self.wait_selector_state = wait_selector_state diff --git a/scrapling/engines/pw.py b/scrapling/engines/pw.py index 16d7a8a..e4c80b7 100644 --- a/scrapling/engines/pw.py +++ b/scrapling/engines/pw.py @@ -75,11 +75,14 @@ class PlaywrightEngine: self.cdp_url = cdp_url self.useragent = useragent self.timeout = check_type_validity(timeout, [int, float], 30000) - if page_action is not None and callable(page_action): - self.page_action = page_action + if page_action is not None: + if callable(page_action): + self.page_action = page_action + else: + self.page_action = None + log.error('[Ignored] Argument "page_action" must be callable') else: self.page_action = None - log.error('[Ignored] Argument "page_action" must be callable') self.wait_selector = wait_selector self.wait_selector_state = wait_selector_state