The current implementation of the window detection in Nintex Kryon RPA does not take into account that a window/website can be open in a hidden tab (tab in the background for example).
In an attended scenario we can't simply close all browsers the user has open, so we need a functionality to activate a browser tab via some advanced command or to make the window-detection natively push something to the extension to bring some defined tab to the foreground.
This can be done by the extensions background.js file!
The example code in the attachment can be executed in that context and brings the found tab to the front. To try that simply open google.com and some other website - and run the code in the background.js context.
Since uploading of txt files is not possible... I'll just paste it here. :/
// can be done via title and url
const SITE_URL = 'google.com';
const SITE_TITLE = 'Google';
// brings tab to front
const highlightTab = async (tab) => {
try {
chrome.tabs.highlight(
{ windowId: tab.windowId, tabs: tab.index },
() => {}
);
} catch (e) {
throw e;
}
};
// checks condition (url, title, ... whatnot)
const checkTabs = async (tabs) => {
let status = false;
for(index in tabs) {
if (tabs[index].url.includes(SITE_URL) && tabs[index].title.includes(SITE_TITLE)) {
console.log('FOUND: ' + tabs[index].title);
try {
highlightTab(tabs[index]);
status = true;
return status;
} catch (e) {
throw e;
}
}
}
return status;
};
// gives us the result (true = found and fired, false = not found, or a speaking error message)
chrome.tabs.query({}, async (tabs) => {
checkTabs(tabs)
.then((r) => {
console.log('Totally Done with Result: ' + r);
})
.catch((e) => {
console.error(e);
});
});
Thank you in advance.