Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash in ParseJson when doing GetAllCookies #145

Open
dornech opened this issue Mar 3, 2025 · 8 comments
Open

crash in ParseJson when doing GetAllCookies #145

dornech opened this issue Mar 3, 2025 · 8 comments

Comments

@dornech
Copy link

dornech commented Mar 3, 2025

I encounter an issue when doing a GetallCookies from a website. The use case is that I do a log in to a website and then read the cookies containing authentication information to reuse them for further data scraping requests. The JSON String is about 11.0000 characters, and contains 34 cookies. The crash without any "normal" VBA error occurs when returning after completing the JSON object paring.

Issue occurs on Windows 11 with Office365 / VBA7.
The Issue does NOT occur on Windows 10 with VBA6 - as some readers know, I did a backport of the VBA source AddIns by just adjusting the declares in WebShared. This works pretty well.

Has anybody else made a similar experience? Is it probably linked to this issue with the original VBA-JSON ?
VBA-tools/VBA-JSON#275

@GCuser99
Copy link
Owner

GCuser99 commented Mar 3, 2025

Hi @dornech - thanks for reporting. Does the crash happen using the SeleniumVBA ActiveX DLL or the VBA code version?

@dornech
Copy link
Author

dornech commented Mar 3, 2025

VBA code version. Otherwise I would not have been able to track it down to the JSON object parsing.

Due to the issue with the TwinBASIC error messages and the re-referencing issue when upgrading I switched my stuff to the VBA version. I re-consider probably as soon as the TwinBasic issue is resolved.

@GCuser99
Copy link
Owner

GCuser99 commented Mar 3, 2025

The tB error issue was resolved a few releases ago. But of course, it will still be easier to debug using the VBA version.

Can you share the cookies string that causes the json parsing error (optionally send privately to my email if you wish)?

@GCuser99
Copy link
Owner

GCuser99 commented Mar 3, 2025

Also, that VBA-JSON issue you referred to above is highly suspect, as the OP was using Fast-Dictionary, not Scripting Dictionary. I know that Fast-Dictionary has had some crash issues that have been resolved recently, since the time of that post.

@dornech
Copy link
Author

dornech commented Mar 4, 2025

{"value":[{"domain":"www.ariva.de","expiry":1741027376,"httpOnly":false,"name":"s_gpv","path":"/","sameSite":"Lax","secure":false,"value":"https://www.ariva.de/euro-stoxx-50-index/kurse/historische-kurse"},{"domain":".ariva.de","expiry":1775585575,"httpOnly":false,"name":"_ga_NBTCZZM6RN","path":"/","sameSite":"Lax","secure":false,"value":"GS1.1.1741025512.1.1.1741025575.59.0.0"},{"domain":".ariva.de","expiry":1768759911,"httpOnly":false,"name":"ioam2018","path":"/","sameSite":"Lax","secure":false,"value":"000c2d8d4df5eb3c967c5f0e8%3A1768759911410%3A1741025511410%3A.ariva.de%3A5%3Aariva%3Aindizes%3Anoevent%3A1741025575907%3Ai98bgq"},{"domain":"www.ariva.de","expiry":1743617534,"httpOnly":false,"name":"_lr_env_src_ats","path":"/","sameSite":"Lax","secure":false,"value":"false"},{"domain":"www.ariva.de","expiry":1741029134,"httpOnly":false,"name":"_lr_retry_request","path":"/","sameSite":"Lax","secure":false,"value":"true"},{"domain":"www.ariva.de","expiry":1756584865,"httpOnly":false,"name":"ISSE_iqd1","path":"/","sameSite":"Lax","secure":false,"value":"9552ab91cad4ab4d9a13feb918f7791b22f412fc%200f68349b84a4f9a96d2c1ea28312bfb9fb4e19c847f2ad41670d6cef9fb931ad%20820abc77e7b12e3ccad861b6c11c69ec%200f68349b84a4f9a96d2c1ea28312bfb9fb4e19c847f2ad41670d6cef9fb931ad"},{"domain":".ariva.de","expiry":1772561511,"httpOnly":false,"name":"consentUUID","path":"/","sameSite":"None","secure":true,"value":"defcef30-9ec0-4616-b7d5-2625e56d393c_41"},{"domain":"www.ariva.de","expiry":1742339531,"httpOnly":false,"name":"kc_refresh_token","path":"/","sameSite":"Lax","secure":false,"value":"eyJhbGciOiJIUzUxMiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJmNjZjZTU2Mi1iNzFiLTRmNGItOGEzMS1jY2IzNTAwMGU0YWUifQ.eyJleHAiOjE3NDk2NjU1MzIsImlhdCI6MTc0MTAyNTUzMiwianRpIjoiMmFlMDE5YzAtOTYyYy00NTdmLWExZWYtMzYzYmEyOTI3ZDYzIiwiaXNzIjoiaHR0cHM6Ly9sb2dpbi5hcml2YS5kZS9yZWFsbXMvYXJpdmEiLCJhdWQiOiJodHRwczovL2xvZ2luLmFyaXZhLmRlL3JlYWxtcy9hcml2YSIsInN1YiI6Ijc3NDFlNDJlLWE0MWQtNGEzZS04ZGQ1LTFkZjIyMDFjODRlMSIsInR5cCI6IlJlZnJlc2giLCJhenAiOiJhcml2YS13ZWIiLCJzaWQiOiI1NzQzZWZkN1mODgyLTQ0MzItYjcyZC0wYmZlNjI3NTE0YWQiLCJzY29wZSI6Im9wZW5pZCBiYXNpYyBwcm9maWxlIHdlYi1vcmlnaW5zIHJvbGVzIGF1dGgtZ2F0ZXdheSBhY3IgZW1haWwifQ.pOClvAFIJrtOPVNledaKRufmrtIWj_QzYAEZc9kUvhy9cw4wyY5AGTUp48KmHd9Fz7Jw8RCc3pOe4bCje8AcoQ"},{"domain":".ariva.de","expiry":1756577513,"httpOnly":false,"name":"kndctr_41833DF75A550B4B0A495DA6_AdobeOrg_iab_persist","path":"/","sameSite":"None","secure":true,"value":"%2D8691329025931177791"},{"domain":"www.ariva.de","expiry":1741284776,"httpOnly":false,"name":"adp_segs","path":"/","sameSite":"Lax","secure":false,"value":"e0"},{"domain":".ariva.de","expiry":1772561512,"httpOnly":false,"name":"_sharedid","path":"/","sameSite":"Lax","secure":false,"value":"f143b582-ff28-4dc9-a551-91a902f92edc"},{"domain":".ariva.de","expiry":1774721513,"httpOnly":false,"name":"__gpi","path":"/","sameSite":"None","secure":true,"value":"UID=0000104e492abfd9:T=1741025513:RT=1741025513:S=ALNI_MZ-mGjlSIqeeXjaxXuR6iu4udKrAg"},{"domain":".ariva.de","expiry":1774721513,"httpOnly":false,"name":"AMCV_41833DF75A550B4B0A495DA6%40AdobeOrg","path":"/","sameSite":"None","secure":true,"value":"MCMID|29263513799097880490510153644611613471"},{"domain":"www.ariva.de","expiry":1741111953,"httpOnly":false,"name":"siteTeaser-800-19533","path":"/","sameSite":"Lax","secure":false,"value":"2%23Tue%2C%20%204%20Mar%202025%2018%3A12%3A34"},{"domain":".ariva.de","expiry":1775153513,"httpOnly":false,"name":"kndctr_41833DF75A550B4B0A495DA6_AdobeOrg_identity","path":"/","sameSite":"None","secure":true,"value":"CiYyOTI2MzUxMzc5OTA5Nzg4MDQ5MDUxMDE1MzY0NDYxMTYxMzQ3MVITCLmm1OnVMhABGAEqBElSTDEwAKABwKbU6dUy8AG5ptTp1TI="},{"domain":"www.ariva.de","expiry":1741284776,"httpOnly":false,"name":"emqsegs","path":"/","sameSite":"Lax","secure":false,"value":"e0"},{"domain":".ariva.de","expiry":1741027377,"httpOnly":false,"name":"kndctr_41833DF75A550B4B0A495DA6_AdobeOrg_cluster","path":"/","sameSite":"None","secure":true,"value":"irl1"},{"domain":".ariva.de","expiry":1756577513,"httpOnly":false,"name":"__eoi","path":"/","sameSite":"None","secure":true,"value":"ID=8d9ca2b482694509:T=1741025513:RT=1741025513:S=AA-Afjbz_EW19iVI9cU8HxjDWgVr"},{"domain":".ariva.de","expiry":1774725176,"httpOnly":false,"name":"cto_bidid","path":"/","sameSite":"Lax","secure":false,"value":"1RrnHl9hJTJCcXI5enFveEZRbllMUXJyS0VVYWpBTllld0x4U1hZUURXJTJGb2FneXBpWlpoNzgwSW5BclpRSHZYUU9OWVpmU3JDODExUDYzNXc4WXFuRHdsVzZtMHAxaTlvWW9mMFh6bHolMkZXRENXSnlSNCUzRA"},{"domain":"www.ariva.de","expiry":1741630300,"httpOnly":false,"name":"pixelratio","path":"/","sameSite":"Lax","secure":false,"value":"1.5"},{"domain":"www.ariva.de","expiry":1742339531,"httpOnly":false,"name":"kc_access_token","path":"/","sameSite":"Lax","secure":false,"value":"eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJxVTljT09SeGlKZ0kzMnNXeUM2NmxOUVJvRmRqWVJZODZSSUp0M2Noc2lzIn0.eyJleHAiOjE3NDEwMjkxMzIsImlhdCI6MTc0MTAyN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qWTJWemN5STZNQ3dpYlc5aWFXeGxJanBtWVd4elpYMD0iLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJycWRteSIsImVtYWlsIjoicnFkbXlAbXVlbGxtYWlsLmNvbSJ9.gZBZ_XwpuMt9wowus8AR8aIVU5AaUXTa7N1Zi8IZBNhowFfqQCcgB7WFKygJhMtl6JLF5zNUvbYWxNV91xOykRRaWYHr8J7OIiciEwHzUQQcR8fiuqfmLBYcHnKVxCrhbpMLvrZ3CTNSFoTDYnAzzf1GaxydFmRN5NJ5Wl6BVSihjPKIsEXmQLbcCfCpDUGnTCxweaGrG6fPEDfqH3v0gS5-7YPHRu0Th99xCQXdDg6mnynQzBvFLmRZv0JFAC11gCDQs1Pnl04CMDMnBP7stVvvniLLvfF6TxErxvN5dqiwwuSbZYaR5BmGfI6O6eY5swy6miW7sb6sHPPtGwyWqQ"},{"domain":".ariva.de","expiry":1772561512,"httpOnly":false,"name":"_sharedid_cst","path":"/","sameSite":"Lax","secure":false,"value":"ASzMLA4stA%3D%3D"},{"domain":"www.ariva.de","expiry":1743617511,"httpOnly":false,"name":"_sp_v1_ss","path":"/","sameSite":"None","secure":true,"value":"1:H4sIAAAAAAAAAItWqo5RKimOUbKKxsrIAzEMamN1YpRSQcy80pwcILsErKC6lgwJpVgAEA5-UnQAAAA%3D"},{"domain":".ariva.de","expiry":1756577513,"httpOnly":false,"name":"kndctr_41833DF75A550B4B0A495DA6_AdobeOrg_consent","path":"/","sameSite":"None","secure":true,"value":"general%3Din"},{"domain":".ariva.de","expiry":1775585575,"httpOnly":false,"name":"_ga","path":"/","sameSite":"Lax","secure":false,"value":"GA1.1.1661155529.1741025513"},{"domain":"www.ariva.de","expiry":1743617511,"httpOnly":false,"name":"_sp_v1_data","path":"/","sameSite":"None","secure":true,"value":"702772"},{"domain":"www.ariva.de","httpOnly":false,"name":"NIPCS","path":"/","sameSite":"Lax","secure":false,"value":"0"},{"domain":".ariva.de","expiry":1772561500,"httpOnly":false,"name":"_sp_su","path":"/","sameSite":"None","secure":true,"value":"false"},{"domain":".ariva.de","expiry":1774721513,"httpOnly":false,"name":"__gads","path":"/","sameSite":"None","secure":true,"value":"ID=ce58a3ef6dd4c46f:T=1741025513:RT=1741025513:S=ALNI_MZRyzdJOe1PMoOFg7j04MvG63aG_w"},{"domain":"www.ariva.de","expiry":1772565176,"httpOnly":false,"name":"consent_yt","path":"/","sameSite":"Lax","secure":false,"value":"1"},{"domain":".ariva.de","expiry":1774721584,"httpOnly":false,"name":"cto_bundle","path":"/","sameSite":"Lax","secure":false,"value":"pUIlXl9yQUJxeCUyQksxcVNJcVJKJTJCRlZxRFlob2doWlpsNXpCQTlPeHhDS3A0JTJCVVVvQVFxNjNnTUpwRWU3Y2p6ZnAwWE9iOHZDYXhLTyUyQmt0ZTNSSXBEUmk0SmxyQ3d6NXl3aGN3TUhhS3pIN2FpdFlLRjIwdW1RVyUyRnpYVFV0d3NwdFNhckRTcHBYdmZUa3c2Z2lMb1dtMU9FdmNRJTNEJTNE"},{"domain":"www.ariva.de","expiry":1743617500,"httpOnly":false,"name":"_sp_v1_p","path":"/","sameSite":"None","secure":true,"value":"454"},{"domain":"www.ariva.de","expiry":1741630338,"httpOnly":false,"name":"_lr_sampling_rate","path":"/","sameSite":"Lax","secure":false,"value":"100"},{"domain":".ariva.de","expiry":1772561511,"httpOnly":false,"name":"consentDate","path":"/","sameSite":"None","secure":true,"value":"2025-03-03T18:11:52.403Z"}]}

@dornech
Copy link
Author

dornech commented Mar 4, 2025

The tB error issue was resolved a few releases ago. But of course, it will still be easier to debug using the VBA version.

Oh I missed that. Thanks for the information!

@GCuser99
Copy link
Owner

GCuser99 commented Mar 4, 2025

Thanks for providing the string. I can't yet replicate the issue. Here is what I tried:

Sub test_parse_cookies()
    Dim driver As WebDriver
    
    Set driver = New WebDriver
    driver.StartEdge
    
    Dim fso As New FileSystemObject
    Dim cookiesString As String
    Dim cookies As Collection
    Dim filePath As String
    
    'put cookies string provided by dornech in file located in same directory as SeleniumVBA.xlsm
    filePath = driver.ResolvePath("dornech_cookies.txt")
    With fso.OpenTextFile(filePath, ForReading)
        cookiesString = .ReadAll
        .Close
    End With
    
    'parse the string into a collection
    Set cookies = WebJsonConverter.ParseJson(cookiesString)("value")
    Debug.Assert cookies.Count = 34
    
    driver.Shutdown
End Sub

BTW, have you seen this registry fix for VBA7?. Cristian Buse uses it to prevent VBA7 crashes. It's a long shot, but might be worth a try...

@dornech
Copy link
Author

dornech commented Mar 4, 2025

The funfact is: if I debug it and step through, it works ... this is absolutely strange.
The registry fix does not overcome the problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants