I need to call a method from within a JavaScript file using execjs
in python. This file has many window
and document
calls. So, execjs
is not able to compile it. Is there any way to bypass this limitation of execjs
? I only need one method from within the file but it has so many other methods it calls which call other methods. Anyway, here is what I have tried so far:
- I have tried putting mockup
window
anddocument
variables. Though, adding/fixing something would break another. So, I finally gave up. - I have considered extracting the method and the method it calls but they are too much. An AI recommended using several extraction methods and tried them but none of them worked.
- I have used PhantomJS but it turns out it does not support
promises
and the script uses those. I cannot use selenium because of my special use case. I want a solution small in size and also portable.
Your feedback is appreciated.