driverScript() throwing element not found error
vasudha0309 opened this issue · 2 comments
Environment (please complete the following information):
Node.js version: 14.19.0
NPM version: 8.18.0
Platform: Android
Platform version: 11
Emulator/Simulator/Real Device: Emulator
Describe the bug
driver.driverScript(script) function is throwing an element not found error, even when no element is being searched for in the script.
�[90m2022-08-23T10:01:38.289Z�[39m �[96mINFO�[39m �[97mwebdriver�[39m: �[36mRESULT�[39m {error: 'no such element', message: 'An element could not be located on the page using the given search parameters.', stacktrace: 'NoSuchElementError: An element could not be…ons (internal/process/task_queues.js:97:5)'}
To Reproduce
const script = console.log("Hello");
;
await driver.driverScript(script);
Expected behavior
I expected the script to run and have a log "Hello" in the console.
Hi @vasudha0309
Thanks for your issue, be aware that driverScript
is an Appium command to run a batch of WDIO commands in the Appium Server, see https://webdriver.io/docs/api/appium/#driverscript and see https://appiumpro.com/editions/85-batching-appium-commands-using-execute-driver-script-to-speed-up-tests for an example.
It's not for injecting JS into the page.
Closing this one because it's not an issue with the boilerplate nor with WDIO, nor with Appium, but an incorrect implementation. If you feel that the docs are not clear enough then feel free to open a PR
Thanks
I created an issue in the appium repository and they cleared it up that exectue_driver endpoint is compatible with appium v2. But on upgrade I was getting another issue regarding socket hang up and multiple appium sessions being created. I am using similar configuration as given in the boilerplate project.
The issue and the observation they had -
appium/appium#17403 (comment)
Can you please confirm how multiple Appium sessions are being invoked? I have also attached my config file -
AndroidConfig.txt