dgtlmoon / changedetection.io

The best and simplest free open source web page change detection, website watcher, restock monitor and notification service. Restock Monitor, change detection. Designed for simplicity - Simply monitor which websites had a text change for free. Free Open source web page change detection, Website defacement monitoring, Price change notification
https://changedetection.io
Apache License 2.0
15.85k stars 884 forks source link

`Goto site` step in the browser steps doesn't work even though it is part of the steps. #2330

Closed manojVivek closed 1 month ago

manojVivek commented 2 months ago

Describe the bug Any Goto site step that is at step index > 0 of the browser steps is not getting executed and getting skipped silently.

Version v0.45.20

To Reproduce

Steps to reproduce the behavior: Create a browser steps workflow with the following steps: Step 1: Goto site Step 2: Click element containing text "Login" Step 3: Enter text in field ".username" "some-username" Step 4: Enter text in field ".password" "some-password" Step 5: Click element button.login Step 6: Goto site Step 7: Click element containing text "show data"

Now, in this example, the step 6 is always skipped when the run is performed, it goes to step 7 after step 5.

! ALWAYS INCLUDE AN EXAMPLE URL WHERE IT IS POSSIBLE TO RE-CREATE THE ISSUE - USE THE 'SHARE WATCH' FEATURE AND PASTE IN THE SHARE-LINK!

Expected behavior It runs the Goto site that is part of the browser steps

Additional context I went through the code a bit and found that the Goto site step is being filtered out in the browser_steps_get_valid_steps function here: https://github.com/dgtlmoon/changedetection.io/blob/1ba29655f5c8d4566a36224030a8cfde2695a361/changedetectionio/content_fetchers/base.py#L116

It makes sense to just remove the Goto site step when it is at Step 1 of the steps, but it should not be filtered when it is at a step other than 1.

Please let me know if you have any questions.

dgtlmoon commented 2 months ago

fantastic report, thanks! will check it out

manojVivek commented 2 months ago

@dgtlmoon If you are fine with the following fix, I can try and make a PR if you are fine with the following fix:

  1. Filter out the Goto site step only when it is at Step 1.
  2. Swap any other Goto site action to Goto URL, watch.url.

Please let me know your thoughts.

dgtlmoon commented 2 months ago

@dgtlmoon If you are fine with the following fix, I can try and make a PR if you are fine with the following fix:

  1. Filter out the Goto site step only when it is at Step 1.
  2. Swap any other Goto site action to Goto URL, watch.url.

Please let me know your thoughts.

yeah goto site should be the first step always

Goto URL should be every other step

problem is you'll also need to create an update hook so that you dont break everyones installations if you simply rename the step...

manojVivek commented 2 months ago

problem is you'll also need to create an update hook so that you dont break everyones installations if you simply rename the step...

No, I didn't mean to replace all Goto site to Goto URL in the datastore. All other Goto site will still be the same in the datastore.

But during the execution, we can do an inline conversion of all non-first-step Goto site into Goto URL with watch.url as arg like in https://github.com/dgtlmoon/changedetection.io/blob/ee5294740afe26cecb432a9dbceffa0ae7dc426d/changedetectionio/blueprint/browser_steps/__init__.py#L170-L173

Wdyt?

manojVivek commented 2 months ago

I have implemented the above explained approach in this PR https://github.com/dgtlmoon/changedetection.io/pull/2337, and it worked well for the use case that was failing for me before.

dgtlmoon commented 1 month ago

Create a browser steps workflow with the following steps: Step 1: Goto site Step 2: Click element containing text "Login" Step 3: Enter text in field ".username" "some-username" Step 4: Enter text in field ".password" "some-password" Step 5: Click element button.login Step 6: Goto site Step 7: Click element containing text "show data"

why are you even using "goto site" as the first step?

manojVivek commented 1 month ago

Create a browser steps workflow with the following steps: Step 1: Goto site Step 2: Click element containing text "Login" Step 3: Enter text in field ".username" "some-username" Step 4: Enter text in field ".password" "some-password" Step 5: Click element button.login Step 6: Goto site Step 7: Click element containing text "show data"

why are you even using "goto site" as the first step?

I'm not using that, I referred this default "Goto Site" step:

Screenshot 2024-05-15 at 2 21 03 PM
dgtlmoon commented 1 month ago

should be resolved with the PR