1

I'm developing a Python application based on the cefpython3. I need to fetch JS window object once the web page is loaded and the JS context is created, and retrieve functions and objects that have been created. I already read its documents, but there is no clue about this!

Any solution?

  • See the `ondomready.py` and `onpagecomplete.py` snippets: https://github.com/cztomczak/cefpython/blob/master/examples/snippets/ondomready.py and https://github.com/cztomczak/cefpython/blob/master/examples/snippets/onpagecomplete.py – Czarek Tomczak Sep 29 '18 at 04:30
  • @CzarekTomczak, Thanks for the comment. However, what I look for is to retrieve values from JS. Imagine the following code is in the loaded page: `var test = 123`, in my python code I want to know that there is variable in JS called 'test' and its value is 123. The links that provided indicate how to know when DOM is ready, and how to execute a JS code on the page. But, how can I get value returned by the executed code? Or access to them by Python without executing JS? is there something similar to `V8context->GetGlobal()` ? – Sina Yazdanmehr Sep 29 '18 at 17:08
  • 1
    You can communicate between py<>js using javascript bindings, see: https://github.com/cztomczak/cefpython/blob/master/examples/snippets/javascript_bindings.py . Detect variables in js and then communicate with python. – Czarek Tomczak Sep 29 '18 at 21:40

0 Answers0