When attempting to execute a script using the executeAsyncScript() method with a fetch call, I am encountering an issue. The fetch call returns a promise, causing a delay in its fulfillment, resulting in a timeout error when executed through the Selenium JavaScript executor. This leads to a null output. How can I achieve the desired outcome using the selenium executeAsyncScript method?
String str = (String) js.executeAsyncScript("var myHeaders = new Headers();\n" +
"myHeaders.append('client-id', 'LPDP');\n" +
"myHeaders.append('a2z-csrf-token', 'NON_SDF');\n" +
...
...
// (continued code snippet)
The variable `str` is returning null. I appreciate any assistance you can provide. Thank you.