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]: Problem with special character in username #11947

Closed
MuhSchaf opened this issue Apr 25, 2023 · 8 comments
Closed

[🐛 Bug]: Problem with special character in username #11947

MuhSchaf opened this issue Apr 25, 2023 · 8 comments

Comments

@MuhSchaf
Copy link

What happened?

Hi dear Selenium-Team,

Selenium manager can’t find browser driver in user directory when the username has special characters inside. Selenium manager throws an DriverServiceNotFound exception.
To avoid this issue the browser driver has to put in the same directory as the program executable.

How can we reproduce the issue?

To reproduce create a Windows Username with a special character like René or Björgensen. After this use Selenium in its default configuration.

Relevant log output

Exception:
OpenQA.Selenium.DriverServiceNotFoundException: The file C:\Users\René\.cache\selenium\chromedriver\win32\112.0.5615.49\chromedriver.exe does not exist. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html
   at OpenQA.Selenium.DriverService..ctor(String servicePath, Int32 port, String driverServiceExecutableName, Uri driverServiceDownloadUrl)
   at OpenQA.Selenium.Chromium.ChromiumDriverService..ctor(String executablePath, String executableFileName, Int32 port, Uri downloadUrl)
   at OpenQA.Selenium.Chrome.ChromeDriverService..ctor(String executablePath, String executableFileName, Int32 port)
   at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService(String driverPath, String driverExecutableFileName)
   at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService(String driverPath)
   at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService()

Operating System

Windows 10

Selenium version

4.8.1

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

Chrome (Version 111), Edge

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

Chromedriver were automatically downloaded by Selenium

Are you using Selenium Grid?

No response

@github-actions
Copy link

@MuhSchaf, 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!

@diemol
Copy link
Member

diemol commented Apr 25, 2023

Please try 4.9.0 and let us know.

@MuhSchaf
Copy link
Author

Thank you for the fast reply.
Today the changeover to 4.9.0 has been approved by my superior. I will update this ticket, when i have new insights.
Have a great week.

@MuhSchaf
Copy link
Author

Update:

After the update was implemented the driver can be found. But as the following exception suggest it can't start the driverService.
The Exception only occurs when (again) the Windows Username has a special character.

System.ComponentModel.Win32Exception (2): Das System kann die angegebene Datei nicht finden [engl: The system cannot find the specified file.].
   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at OpenQA.Selenium.DriverService.Start()
   at OpenQA.Selenium.Remote.DriverServiceCommandExecutor.Execute(Command commandToExecute)
   at OpenQA.Selenium.WebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
   at OpenQA.Selenium.WebDriver.StartSession(ICapabilities desiredCapabilities)
   at OpenQA.Selenium.WebDriver..ctor(ICommandExecutor executor, ICapabilities capabilities)
   at OpenQA.Selenium.Chromium.ChromiumDriver..ctor(ChromiumDriverService service, ChromiumOptions options, TimeSpan commandTimeout)
   at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)

@diemol diemol added this to the 4.10 milestone Apr 26, 2023
@diemol
Copy link
Member

diemol commented May 4, 2023

I thought this was an issue in the C# code but it is actually an issue in the Rust code. @bonigarcia, do you have a moment to check?

@diemol diemol added C-rust and removed C-dotnet labels May 4, 2023
@bonigarcia
Copy link
Member

I thought this was an issue in the C# code but it is actually an issue in the Rust code.

@diemol How do you know it is a Rust problem?

I tried this on a Windows machine, forcing to use a home folder containing an special character (René), and it seems to work as expected:

     Running `target\debug\selenium-manager.exe --browser chrome --debug`
DEBUG   Using shell command to find out chrome version
DEBUG   Running command: "set PFILES=%PROGRAMFILES: (x86)=%&& wmic datafile where name='!PFILES:\\=\\\\!\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe' get Version /value"
DEBUG   Output: "\r\r\n\r\r\nVersion=112.0.5615.138\r\r\n\r\r\n\r\r\n\r"
DEBUG   The version of chrome is 112.0.5615.138
DEBUG   Detected browser: chrome 112
DEBUG   Reading chromedriver version from https://chromedriver.storage.googleapis.com/LATEST_RELEASE_112
DEBUG   Required driver: chromedriver 112.0.5615.49
DEBUG   Running command: "chromedriver --version"
DEBUG   Output: ""
DEBUG   Driver URL: https://chromedriver.storage.googleapis.com/112.0.5615.49/chromedriver_win32.zip
DEBUG   File extracted to C:\Users\René\.cache\selenium\chromedriver\win32\112.0.5615.49\chromedriver.exe (12764160 bytes)
INFO    C:\Users\René\.cache\selenium\chromedriver\win32\112.0.5615.49\chromedriver.exe
     Running `target\debug\selenium-manager.exe --browser chrome --debug --output json`
{
  "logs": [
    {
      "level": "DEBUG",
      "timestamp": 1683214168,
      "message": "Using shell command to find out chrome version"
    },
    {
      "level": "DEBUG",
      "timestamp": 1683214168,
      "message": "Running command: \"set PFILES=%PROGRAMFILES: (x86)=%&& wmic datafile where name='!PFILES:\\\\=\\\\\\\\!\\\\\\\\Google\\\\\\\\Chrome\\\\\\\\Application\\\\\\\\chrome.exe' get Version /value\""
    },
    {
      "level": "DEBUG",
      "timestamp": 1683214168,
      "message": "Output: \"\\r\\r\\n\\r\\r\\nVersion=112.0.5615.138\\r\\r\\n\\r\\r\\n\\r\\r\\n\\r\""
    },
    {
      "level": "DEBUG",
      "timestamp": 1683214168,
      "message": "The version of chrome is 112.0.5615.138"
    },
    {
      "level": "DEBUG",
      "timestamp": 1683214168,
      "message": "Detected browser: chrome 112"
    },
    {
      "level": "DEBUG",
      "timestamp": 1683214168,
      "message": "Reading chromedriver version from https://chromedriver.storage.googleapis.com/LATEST_RELEASE_112"
    },
    {
      "level": "DEBUG",
      "timestamp": 1683214168,
      "message": "Required driver: chromedriver 112.0.5615.49"
    },
    {
      "level": "DEBUG",
      "timestamp": 1683214168,
      "message": "Running command: \"chromedriver --version\""
    },
    {
      "level": "DEBUG",
      "timestamp": 1683214168,
      "message": "Output: \"\""
    },
    {
      "level": "DEBUG",
      "timestamp": 1683214168,
      "message": "Driver URL: https://chromedriver.storage.googleapis.com/112.0.5615.49/chromedriver_win32.zip"
    },
    {
      "level": "DEBUG",
      "timestamp": 1683214168,
      "message": "File extracted to C:\\Users\\René\\.cache\\selenium\\chromedriver\\win32\\112.0.5615.49\\chromedriver.exe (12764160 bytes)"
    },
    {
      "level": "INFO",
      "timestamp": 1683214169,
      "message": "C:\\Users\\René\\.cache\\selenium\\chromedriver\\win32\\112.0.5615.49\\chromedriver.exe"
    }
  ],
  "result": {
    "code": 0,
    "message": "C:\\Users\\René\\.cache\\selenium\\chromedriver\\win32\\112.0.5615.49\\chromedriver.exe"
  }
}

My guess is that the problem is the parsing of the JSON output in the dotnet bindings.

@MuhSchaf You can isolate the Rust side by running Selenium Manager separately. You can get the Windows binary from here:

https://github.com/SeleniumHQ/selenium/raw/trunk/common/manager/windows/selenium-manager.exe

... and then, you should be able to run the following command from the shell:

selenium-manager --browser chrome --debug

@diemol
Copy link
Member

diemol commented May 4, 2023

Yeah, you are right, I think I got carried away while debugging and missed an extra test. Will have a look again.

@diemol diemol added C-dotnet and removed C-rust labels May 4, 2023
@diemol diemol closed this as completed in bfcda90 May 5, 2023
@diemol diemol removed this from the 4.10 milestone May 5, 2023
Copy link

github-actions bot commented Dec 9, 2023

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

@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2023
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

4 participants