Triggering uivision from a Chrome extension using JS

Hi,

I’m new to uivision, but I’m hoping it will be perfect for the project I’m working on.

I’m creating my own Chrome plugin to automate form filling in browser. Under the hood the Chrome extension just runs as Javascript. Currently I am triggering form changes from the extension using the following simple JS code:

function setValue(field, value) {
switch (field.type) {
case ‘radio’:
case ‘checkbox’:
field.checked = field.value === value;
break;
case ‘select-one’:
case ‘select-multiple’:
Array.from(field.options).forEach(option => {
option.selected = option.value === value;
});
break;
default:
field.value = value;
}
}

The issue with the above is that when I set the form values the browser will not always execute the page’s JS related to the field. To resolve this I’m hoping that xclick can work for me.

Once invision is installed, is it possible to trigger xclick using something like this in my extension’s JS?

function clickElement(selector) {
// Send the command to UI.Vision
UI.Vision.sendCommand(click | ${selector});
}

If so how do I achieve this?

Thanks

Has anyone got any ideas on this one - is there a way to trigger xclick from JS in the browser?