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

[🐛 Bug]: NoSuchDriverException for Windows app execution aliases #14088

Closed
vlad8x8 opened this issue Jun 5, 2024 · 12 comments
Closed

[🐛 Bug]: NoSuchDriverException for Windows app execution aliases #14088

vlad8x8 opened this issue Jun 5, 2024 · 12 comments

Comments

@vlad8x8
Copy link
Contributor

vlad8x8 commented Jun 5, 2024

What happened?

The default way to run MS Teams desktop client (which is MSEdge-based app) is a Windows app execution aliass located at UserFolder\AppData\Local\Microsoft\WindowsApps\ms-teams.exe)
Selenium Manager is failing on this file.
The issue started on Selenium 4.20 because of https://github.com/SeleniumHQ/selenium/blob/4ecc1033caa9995427c25d36befb70b8faae96d7/java/src/org/openqa/selenium/internal/Require.java
No issue with Selenium 4.19

org.openqa.selenium.internal.Require.FileStateChecker#isFile throws errors for Windows app execution aliases

How can we reproduce the issue?

https://github.com/vlad-velichko/selenium-bug-14088

Relevant log output

org.openqa.selenium.remote.NoSuchDriverException: Unable to obtain: msedgedriver, error MicrosoftEdge must exist: C:\Users\me\AppData\Local\Microsoft\WindowsApps\ms-teams.exe
For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location/
Build info: version: '4.21.0', revision: '79ed462ef4'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '21-ea'
Driver info: driver.version: SelenideDriver

	at org.openqa.selenium.remote.service.DriverFinder.getBinaryPaths(DriverFinder.java:121)
	at org.openqa.selenium.remote.service.DriverFinder.getDriverPath(DriverFinder.java:55)
	at org.openqa.selenium.edge.EdgeDriver.generateExecutor(EdgeDriver.java:71)
	at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:60)
	at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:56)

Workaround

Get the app execution alias link from Windows registry

Operating System

Windows 10

Selenium version

Java 4.21.0

What are the browser(s) and version(s) where you see this issue?

MS Teams based on MS Edge based on Chrome 125

What are the browser driver(s) and version(s) where you see this issue?

msedgedriver 125.0.2535.85

Copy link

github-actions bot commented Jun 5, 2024

@vlad8x8, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@titusfortner titusfortner added the I-logging Applied to issues where logging information would help troubleshoot label Jun 6, 2024
Copy link

github-actions bot commented Jun 6, 2024

We need more information about this issue in order to troubleshoot.

Please turn on logging and re-run your code. Information on how to adjust logs for your language can be found in our
Troubleshooting documentation.

@vlad8x8
Copy link
Contributor Author

vlad8x8 commented Jun 6, 2024

added link to the repo with a project to reproduce the issue

@vlad8x8 vlad8x8 changed the title [🐛 Bug]: NoSuchDriverException for symbolic links [🐛 Bug]: NoSuchDriverException for Windows app execution aliases Jun 17, 2024
@vlad8x8
Copy link
Contributor Author

vlad8x8 commented Jun 17, 2024

@titusfortner is there a chance to remove file checks added in


for browser path?
What is the reason for those checks?

@titusfortner titusfortner added C-java and removed I-logging Applied to issues where logging information would help troubleshoot labels Jun 17, 2024
@titusfortner
Copy link
Member

We check the validity of the output so that we can provide better error messaging about why things aren't working. I see that Windows aliases do not like this code. The right answer I believe is to also check for Files.isSymbolicLink(file.toPath(). Would you be interested in making a PR for it?

@vlad8x8
Copy link
Contributor Author

vlad8x8 commented Jun 17, 2024

@titusfortner After exploring this I realized, that this is not a symbolic link, it's an app execution alias.
I can try to add a method isAppExecutionAlias(), but not sure if it won't fail on some non-Windows systems.

@vlad8x8
Copy link
Contributor Author

vlad8x8 commented Jun 17, 2024

the method can be like this:

boolean isAppExecutionAlias() {
    final int WINDOWS_FILE_ATTRIBUTE_REPARSE_POINT = 0x400;
    if (FileSystems.getDefault().supportedFileAttributeViews().contains("dos")) {
        int fileAttrs = (int) Files.getAttribute(path, "dos:attributes", LinkOption.NOFOLLOW_LINKS);
        return (fileAttrs & WINDOWS_FILE_ATTRIBUTE_REPARSE_POINT) != 0;
    }
}

can I add it to Require.java or there is a better place?

@titusfortner
Copy link
Member

Wow, that gets ugly. Please PR it to Require so we can check as part of isFile, we can discuss (with the more Java experts on the team) if this is the best way to do it.

Thank you!

@joerg1985
Copy link
Member

This has been fixed in 2a7ddf1 by checking the executable state using the newer java.nio methods. I have deprecated the java.io stuff, so this can be removed in the future, if everything is working as expected.

@vlad8x8
Copy link
Contributor Author

vlad8x8 commented Jun 20, 2024

@joerg1985 your commit doesn't use java.nio.file.LinkOption.NOFOLLOW_LINKS which is critical

are you guys pushing to master? omg

@joerg1985
Copy link
Member

@vlad8x8 i have missed to update the existence check, i did not expect this to fail in this case.
I am using Files.notExists now to avoid a broken symlink to pass the check.

Small and limited changes are happening on trunk, bigger / complex in PRs.

Copy link

This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants