I want to write test cases for a website that uses Shadow Root. There is a button within a Shadow Root that I want to automate pressing. I was able to write a Selenium script in Python to press that button. What I am wondering is if there is a way I can included a Python script (preferably Selenium) within the Kantu Chrome Browser extension?
I can think of three solutions:
Forget about the website internals (here: shadow DOM), and use XClick (image of button) or XClick (OCR=text on button) to find and click the button
You can call your Python script from within a UI Vision macro with the XRun command. This is the solution you asked about.
Or the other way around, you can start UI Vision from Python via the command line API
Thanks for the help!
For XRun, I was wondering if you know how to pass parameters to the script? I would ideally need to be able to pass it an HTML page and have the python script interact with it before determining if my code passed or failed the test.
You pass the parameters in the value field. If you need to pass a complete HTML page, I would first save it to the hard drive (e.g. with localStorageExport) and then pass the file path to the Python script.
And if you want to return a value from the Python script to UIVision (e. g. the pass/fail status), you can set the exit code. I think in Python that is done by calls to
sys.exit() . The argument to that method is returned to the environment as the exit code.
Inside UIVision, the value is captured in the