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
16.85k stars 941 forks source link

Cannot read properties of null (reading 'scrollTop') at eval #1269

Open blippercop opened 1 year ago

blippercop commented 1 year ago

Describe the bug I often get an error for checks: TypeError: Cannot read properties of null (reading 'scrollTop') at eval (eval at evaluate (:191:30), :12:67) at UtilityScript.evaluate (:198:19) at UtilityScript. (:1:44)

If i manually click recheck it works (sometime it takes two tries) without changing the element.

What causes this?

Version v0.40.0.3

To Reproduce You cant. It happens randomly. But there are multiple elements that have that error and it are not always the same items it seems.

! 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! As said it happens randomly and works if I click recheck - URL is useless but here: https://www.parallels.com/de/products/desktop/buy/?full

Expected behavior A clear and concise description of what you expected to happen.

Screenshots Github throws an error uploading a jpg / png.

Desktop (please complete the following information): Docker with playwright

dgtlmoon commented 1 year ago

If you put 10 seconds into the Request > Wait seconds before extracting text does it solve it?

wajdi-b commented 1 year ago

I have the same error for many items. They all had a 4 seconds wait time. Trying now with 10 but I think it's another issue.

wajdi-b commented 1 year ago

Another similar error I see since the update with an item that contains javascript commands. I think it is related to the root cause.

Page request from server didnt respond correctly - TypeError: Cannot read properties of null (reading 'click') at eval (eval at evaluate (:191:30), <anonymous>:1:45) at eval (<anonymous>) at UtilityScript.evaluate (<anonymous>:191:30) at UtilityScript.<anonymous> (<anonymous>:1:44)

martinjuhasz commented 1 year ago

I'm experiencing the same issue lately. added a ten second delay, will see if that fixes it. had a 4 second delay before.

// edit: nope, still seems to occur occacionally on mutliple items

ekasprzak commented 1 year ago

Same here, happens randomly on multiple items, delay doesn't seem to matter (tried with none/5/10/15 seconds).

Error like with [Lapsusone] above: TypeError: Cannot read properties of null (reading 'scrollTop') at eval (eval at evaluate (:191:30), <anonymous>:12:67) at UtilityScript.evaluate (<anonymous>:198:19) at UtilityScript.<anonymous> (<anonymous>:1:44)

and this is without any additional setup (no javascript before change detection etc).

wrobelda commented 1 year ago

This appears to have replaced the message of the issue behind https://github.com/dgtlmoon/changedetection.io/issues/755

All the same checks that failed randomly with #755 on my end, now appear to fail with TypeError: Cannot read properties of null

dgtlmoon commented 1 year ago

@wrobelda nothing at all todo with #755

A simple search shows me the error comes from here

https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/res/xpath_element_scraper.js#L12

So putting 2 and 2 together, it tells me that this script is running when the browser is not ready, I dont know why that is (yet)

ideas?

dgtlmoon commented 1 year ago

that code gets called after all waiting/delays running steps etc.. so it should be ready for the browser..

wajdi-b commented 1 year ago

Another error that might be related that I see on an item with nothing else than wait time set at 10s.

Screenshot unavailable, page did not render fully in the expected time - try increasing 'Wait seconds before extracting text'
sclarkso commented 1 year ago

I was getting this error when I had ad-block enabled in playwright. Disabling it seems to have resolved it. Could just be anecdotal at this point though.

djak250 commented 1 year ago

I was getting this error when I had ad-block enabled in playwright. Disabling it seems to have resolved it. Could just be anecdotal at this point though.

This also fixed things for me. DEFAULT_BLOCK_ADS=false or comment it out in the docker-compose for playwright-chrome

ekasprzak commented 1 year ago

@sclarkso thanks a lot for that advice!

After a week of testing I can also confirm this problem is gone when adblock is disabled, in my case it also fixed few other (like some sites detecting that it is a robot and forcing CAPTCHA for a human check - no more of that after disabling adblock).

wrobelda commented 1 year ago

Same here. No more issues.

madfusker commented 1 year ago

Thanks for the fix!

timothyquan commented 1 year ago

I was getting this error when I had ad-block enabled in playwright. Disabling it seems to have resolved it. Could just be anecdotal at this point though.

Thanks, that fixed it for me too!

mckelvym commented 1 year ago

I can confirm TypeError: Cannot read properties of null is resolved by setting DEFAULT_BLOCK_ADS=false for me.

I was on a much older version of changedetection and upgraded to the latest recently. After encountering these errors, I tried various strategies such as increasing the timeout, deleting the watch and re-adding, etc., but none of those helped until the above suggested change.

Thanks @sclarkso & @djak250

jonoff commented 11 months ago

Commenting to confirm my error is fixed as well after ad-block disabling: TypeError: Cannot set properties of undefined at eval when adding Javascript to execute to watches.