From 284f2773b3e2cdf4c81bb1b1e43d1f1294bd09c4 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Sun, 12 Mar 2023 17:01:31 +0100 Subject: [PATCH] Closes #1450 --- changedetectionio/blueprint/browser_steps/__init__.py | 4 ++-- changedetectionio/blueprint/browser_steps/browser_steps.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/changedetectionio/blueprint/browser_steps/__init__.py b/changedetectionio/blueprint/browser_steps/__init__.py index d49af7a4..a1db1c9e 100644 --- a/changedetectionio/blueprint/browser_steps/__init__.py +++ b/changedetectionio/blueprint/browser_steps/__init__.py @@ -106,8 +106,8 @@ def construct_blueprint(datastore: ChangeDetectionStore): if step_operation == 'Goto site': step_operation = 'goto_url' - step_optional_value = None - step_selector = datastore.data['watching'][uuid].get('url') + step_optional_value = datastore.data['watching'][uuid].get('url') + step_selector = None # @todo try.. accept.. nice errors not popups.. try: diff --git a/changedetectionio/blueprint/browser_steps/browser_steps.py b/changedetectionio/blueprint/browser_steps/browser_steps.py index e2525453..ba8b0b57 100644 --- a/changedetectionio/blueprint/browser_steps/browser_steps.py +++ b/changedetectionio/blueprint/browser_steps/browser_steps.py @@ -25,6 +25,7 @@ browser_step_ui_config = {'Choose one': '0 0', 'Execute JS': '0 1', # 'Extract text and use as filter': '1 0', 'Goto site': '0 0', + 'Goto URL': '0 1', 'Press Enter': '0 0', 'Select by label': '1 1', 'Scroll down': '0 0', @@ -54,7 +55,7 @@ class steppable_browser_interface(): print("> action calling", call_action_name) # https://playwright.dev/python/docs/selectors#xpath-selectors - if selector.startswith('/') and not selector.startswith('//'): + if selector and selector.startswith('/') and not selector.startswith('//'): selector = "xpath=" + selector action_handler = getattr(self, "action_" + call_action_name) @@ -73,10 +74,10 @@ class steppable_browser_interface(): self.page.wait_for_timeout(3 * 1000) print("Call action done in", time.time() - now) - def action_goto_url(self, url, optional_value): + def action_goto_url(self, selector, value): # self.page.set_viewport_size({"width": 1280, "height": 5000}) now = time.time() - response = self.page.goto(url, timeout=0, wait_until='commit') + response = self.page.goto(value, timeout=0, wait_until='commit') # Wait_until = commit # - `'commit'` - consider operation to be finished when network response is received and the document started loading.