08-07-26 12:14 PM
Hello, we are currently getting an Error with one of are Edge browser process's when it tries to invoke JavaScript. We are getting the error:
| ERROR: Internal : Failed to perform step 2 in Navigate Stage 'Inject and run cookie javascript' on page 'Login' - JavaScript invoker returned the following error message: Attempted to Invoke JavaScript without Web Driver |
The Web Driver, and Edge version appear to be the same version (150).
tommar_0-1783507188065.png
tommar_3-1783509179780.png
The navigation stage throwing the error itself is made up of 2 parts.
The first action is a insert JavaScript function which sets up the script we run, the second stage is a invoke JavaScript function which executes the function set in stage 1 (the script is stored in the data item [JS-MODSESSION]). They both run against the root of the website.
tommar_1-1783508303215.png
tommar_2-1783508311695.png
The Script it uses is the following (for context this script is used to grab the current session token, so we can use the website's API to carry some tasks where the website interface itself is unsuitable for spying):
function createAndPopulateMODSESSIONTextBox() {
// 1. Get the MODSESSION value
const modSessionValue = document.cookie;
// 2. Create the text box element
const modSessionTextBox = document.createElement('input');
// 3. Set attributes for the text box
modSessionTextBox.type = 'text';
modSessionTextBox.id = 'MODSESSION'; // Assign an ID for easy reference
modSessionTextBox.readOnly = true; // Make it read-only if you just want to display the value
modSessionTextBox.value = modSessionValue; // Set the retrieved value
const label = document.createElement('label');
label.htmlFor = 'MODSESSION';
label.textContent = 'MODSESSION: ';
document.body.appendChild(label);
document.body.appendChild(modSessionTextBox);
}Any help would be appreciated.
yesterday - last edited yesterday
I'm responding simply because of the words "temporary fix". I don't know if this will get reverted in Edge or not, but I believe it is a better idea to continue using the --user-data-dir argument given that it has been needed in Chrome for a while, as Walter mentioned.
I also saw this issue back when you were all discussing it a month or so ago and found that --user-data-dir was the answer.
Anyway, in case anyone else comes across this, Walter's suggestion is the correct solution which is to add an argument when launching such as "--user-data-dir=C:\SomeFolderPath" so that a new Edge profile is used and the default one is not. If the browser extension is force installed (which I believe is the default behavior these days), then it should also get installed automatically after a brief delay after the first or second time of opening Edge with that profile.
I did also have to change the permissions on the C drive or whatever folder was being targeted so that Edge could write to it.
One other thing is that as far as I've found, there is no need to use Start Process and then later attach. You can directly use the --user-data-dir argument directly in Application Modeller or provided to the Launch navigate stage.