Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appWorkingDir fails for shortcut #117

Open
Alek5andr opened this issue Nov 30, 2021 · 6 comments
Open

appWorkingDir fails for shortcut #117

Alek5andr opened this issue Nov 30, 2021 · 6 comments

Comments

@Alek5andr
Copy link

Hi!

  • Node v14.17.2
  • webdriverio 6.12.1
  • @wdio/appium-service 6.12.1
  • appium 1.22.0

Test run fails with message:

DEBUG webdriver: request failed due to response error: unknown error
ERROR webdriver: Request failed with status 500 due to unknown error: An unknown server-side error occurred while processing the command. Original error:
 The system cannot find the file specified
ERROR webdriver: unknown error: An unknown server-side error occurred while processing the command. Original error: The system cannot find the file speci
fied
    at Object.getErrorFromResponseBody (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\webdriverio\node_modules\webdriver\build\utils.js:94:12)
    at WebDriverRequest._request (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\webdriverio\node_modules\webdriver\build\request.js:134:31)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at Object.startWebDriverSession (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\webdriverio\node_modules\webdriver\build\utils.js:29:20)
    at Function.newSession (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\webdriverio\node_modules\webdriver\build\index.js:35:45)
    at Object.exports.remote (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\webdriverio\build\index.js:53:22)
    at Runner._startSession (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\@wdio\runner\build\index.js:123:56)
    at Runner._initSession (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\@wdio\runner\build\index.js:103:25)
    at Runner.run (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\@wdio\runner\build\index.js:52:19)
ERROR @wdio/runner: Error: Failed to create session.
An unknown server-side error occurred while processing the command. Original error: The system cannot find the file specified
    at Object.startWebDriverSession (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\webdriverio\node_modules\webdriver\build\utils.js:34:15)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at Function.newSession (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\webdriverio\node_modules\webdriver\build\index.js:35:45)
    at Object.exports.remote (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\webdriverio\build\index.js:53:22)
    at Runner._startSession (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\@wdio\runner\build\index.js:123:56)
    at Runner._initSession (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\@wdio\runner\build\index.js:103:25)
    at Runner.run (C:\Users\User\IdeaProjects\lennuk-ui\node_modules\@wdio\runner\build\index.js:52:19)
DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 1
FAILED in T:/SSLLennuk/DXE/Lennuk-Shortcut.lnk - C:\Users\User\IdeaProjects\lennuk-ui\test\lennuk.spec.ts

when synergy of arguments "appWorkingDir" & "app" are used for launching application via its shortcut. For instance:

{
 appWorkingDir: 'T:/Delphi/',
 app: 'T:/Delphi/Lennuk-Shortcut.lnk'
}

Launching the test with only property "app" is fine for shortcuts. However, the app uses a certificate, what it searches for in app's directory. That's why I need property "appWorkingDir" to work with shortcuts too (it's fine with app: '*.exe').

Immediate answer regarding *.exe:
Path to direct .exe fail I cannot use, because its name changes constantly.
The second reason is that specific flag = "appArguments" is specified in shortcut.
There is no flag for the application to specify a path to the necessary certificate.

Any help/solution?

@mykola-mokhnach
Copy link

Please provide the full server log

@Alek5andr
Copy link
Author

Please provide the full server log

appium-server-logs.txt
Here you go!
If you know exactly what to look for, please share. I could not figure out useful info.

@mykola-mokhnach
Copy link

[debug] �[35m[WinAppDriver]�[39m {"desiredCapabilities":{"platformName":"windows","ms:experimental-webdriver":true,"ms:waitForAppLaunch":21,"deviceName":"WindowsPC","appWorkingDir":"T:/Delphi/","app":"T:/Delphi/Lennuk-Shortcut.lnk"}}[info] �[35m[WD Proxy]�[39m Got response with status 500: {"status":13,"value":{"error":"unknown error","message":"The specified executable is not a valid application for this OS platform."}}
[debug] �[35m[W3C]�[39m Matched W3C error code 'unknown error' to UnknownError
[warn] �[35m[WinAppDriver]�[39m Could not start WinAppDriver session error = 'An unknown server-side error occurred while processing the command. Original error: The specified executable is not a valid application for this OS platform.', attempt = '1' from 'undefined'
[debug] �[35m[WinAppDriver]�[39m HTTP/1.1 500 Internal Error

I'd say WAD does not support providing aliases as app. It must be an executable or an UWP app name.

@Alek5andr
Copy link
Author

I'd say WAD does not support providing aliases as app. It must be an executable or an UWP app name.

Damn!
In my situation shortcut is located on network drive, directing to last Delphi application version. It's impossible to predict, what version was released last (no info how dost shortcut compilates either).

Close the thread, if no more suggestions.

@mykola-mokhnach
Copy link

Isn't it possible to figure out what app path the alias is pointing to from the client code before creating the session? Something like https://stackoverflow.com/questions/39309779/how-to-get-full-target-string-from-shortcut-lnk

@Alek5andr
Copy link
Author

Isn't it possible to figure out what app path the alias is pointing to from the client code before creating the session?

As for a possible solution, I have implemented shortcut's target field's value grabber using command line tools:

import { execSync } from 'child_process';
execSync(`type ${filePath} | find "${searchValue}"`).toString();

where "type" - displays the contents of a text file, "find" - searches for a string of text in a file or files.

After grabbing I provide "app" property with a necessary app's version of exe-file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants