Forum Discussion

dineth's avatar
dineth
Occasional Contributor
5 years ago

JavaFX Webview support using python scripts

Hi All, 

 

I am currently trying to write an automation test script in python to find and interact with objects that are located on a JavaFX Webview window. I have seen the feature request thread which states that there is currently no support for JavaFX Webview controls but I have also seen that it is possible to interact with the Webview controls using the WebEngine object.

 

Is there a way of interacting with this WebEngine object within a python script or are there any other alternatives which would allow me to interact with objects on the JavaFX Webview window?

 

Feature Request 

 

Possible WebEngine solution 

 

Kind regards,

Dineth

 

 

  • Yeah so the method worked, I was able to obtain the webEngine and its document. I've just got to work out how to find the elements on the page and interact with them.

    This is the code I used, web_page was defined earlier and is the fullName of the WebView object in object spy.

    web_engine = web_page.getEngine()

    doc = web_engine.getDocument()

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    The solution provided is language agnostic.  If you adapt it to Python syntax, best I can tell, it should still work.

    • dineth's avatar
      dineth
      Occasional Contributor

      Hi Robert,

       

      Thanks for your reply. Do you have any ideas of how I would access the WebEngine object or find the name of it? Is this something that would come up in object spy or should I just try and set a variable to equal to xx.getEngine() and see how it goes?

       

      Kind regards,

      Dineth

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        Based upon my minimal knowledge, getEngine is a native method of the web view object.  So, it's not part of TestComplete or anything.  If you have a webview object, it should have the getEngine method.  So... give it a try.