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?
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
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.
cmdline%20parameters
827×209 27 KB
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
${!xrun_exitcode}
variable.