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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰 Bug]: can not launch geckodriver.exe under cygwin environment #12618

Closed
mora-01 opened this issue Aug 26, 2023 · 19 comments
Closed

[馃悰 Bug]: can not launch geckodriver.exe under cygwin environment #12618

mora-01 opened this issue Aug 26, 2023 · 19 comments

Comments

@mora-01
Copy link

mora-01 commented Aug 26, 2023

What happened?

Under Cygwin environment using selenium-webdriver version 11.4? I got the error :

/home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/child_process.rb:57:in `spawn': No such file or directory - D:\cygwin64_latest\cygwin64\usr\local\bin\geckodriver.exe
(Errno::ENOENT)

I use this workaround to resolve the issue.
In selenium-webdriver-4.11.0/lib/selenium/webdriver/common/service.rb file, I replace
@executable_path = path by @executable_path = '/usr/local/bin/geckodriver.exe' in initialize method.

How can we reproduce the issue?

require 'watir'
Watir::Browser.new :firefox

Relevant log output

/home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/child_process.rb:57:in `spawn': No such file or directory - D:\cygwin64_latest\cygwin64\usr\local\bin\geckodriver.exe (Errn
o::ENOENT)
        from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/child_process.rb:57:in `start'
        from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/service_manager.rb:104:in `start_process'
        from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/service_manager.rb:57:in `block in start'
        from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/socket_lock.rb:42:in `locked'
        from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/service_manager.rb:55:in `start'
        from <internal:kernel>:90:in `tap'
        from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/service.rb:91:in `launch'
        from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/driver.rb:334:in `service_url'
        from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/local_driver.rb:28:in `initialize_local_driver'
        from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/firefox/driver.rb:42:in `initialize'
        from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/driver.rb:53:in `new'
        from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/driver.rb:53:in `for'
        from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver.rb:88:in `for'
        from /home/mcheav/.gem/ruby/3.2.0/gems/watir-7.3.0/lib/watir/browser.rb:46:in `initialize'

Operating System

Cygwin

Selenium version

Ruby 4.11.0

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

Firefox 116.0.3 (64 bits)

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

geckodriver 0.33.0

Are you using Selenium Grid?

No response

@github-actions
Copy link

@mora-01, 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
Copy link
Member

@mora-01 thanks. Can you

  1. Delete all drivers on your system
  2. Re-run that code with Watir.logger.selenium = :debug?

@mora-01
Copy link
Author

mora-01 commented Aug 27, 2023 via email

@titusfortner
Copy link
Member

Huh, that's weird that the system reports that as the location but that Ruby can't use it at that location.

Try deleting the driver at this location: D:\cygwin64_latest\cygwin64\usr\local\bin\geckodriver.exe
Then re-run

@mora-01
Copy link
Author

mora-01 commented Aug 27, 2023

output after deleting the driver at this location: D:\cygwin64_latest\cygwin64\usr\local\bin\geckodriver.exe and re-run :
require 'watir'
Watir.logger.selenium = :debug
Watir::Browser.new :firefox

2023-08-27 15:35:42 INFO Selenium [:logger_info] Details on how to use and modify Selenium logger:
https://selenium.dev/documentation/webdriver/troubleshooting/logging

2023-08-27 15:35:42 DEBUG Selenium [:selenium_manager] Selenium Manager binary found at /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/bin/windows/selenium-manager.exe
2023-08-27 15:35:42 DEBUG Selenium [:selenium_manager] Executing Process ["/home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/bin/windows/selenium-manager.exe", "--browser", "firefox", "--output", "json",
"--debug"]
2023-08-27 15:36:04 DEBUG Selenium [:selenium_manager] Checking geckodriver in PATH
2023-08-27 15:36:04 DEBUG Selenium [:selenium_manager] Running command: geckodriver --version
2023-08-27 15:36:04 DEBUG Selenium [:selenium_manager] Output: ""
2023-08-27 15:36:04 DEBUG Selenium [:selenium_manager] geckodriver not found in PATH
2023-08-27 15:36:04 DEBUG Selenium [:selenium_manager] firefox detected at C:\Program Files\Mozilla Firefox\firefox.exe
2023-08-27 15:36:04 DEBUG Selenium [:selenium_manager] Using shell command to find out firefox version
2023-08-27 15:36:04 DEBUG Selenium [:selenium_manager] Running command: wmic datafile where name='C:\Program Files\Mozilla Firefox\firefox.exe' get Version /value
2023-08-27 15:36:04 DEBUG Selenium [:selenium_manager] Output: "\r\r\n\r\r\nVersion=116.0.3.8627\r\r\n\r\r\n\r\r\n\r"
2023-08-27 15:36:04 DEBUG Selenium [:selenium_manager] Detected browser: firefox 116.0.3.8627
2023-08-27 15:36:04 ERROR Selenium [:selenium_manager] error sending request for url (https://github.com/mozilla/geckodriver/releases/latest): error trying to connect: tcp connect error: Une tentative de connexion
a 茅chou茅 car le parti connect茅 n鈥檃 pas r茅pondu convenablement au-del脿 d鈥檜ne certaine dur茅e ou une connexion 茅tablie a 茅chou茅 car l鈥檋么te de connexion n鈥檃 pas r茅pondu. (os error 10060)
/home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/driver_finder.rb:30:in rescue in path': Unable to obtain geckodriver using Selenium Manager; Unsuccessful command executed : ["/home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/bin/windows/selenium-manager.exe", "--browser", "firefox", "--output", "json", "--debug"] (Selenium::WebDriver::Error::NoSuchDriverError) {"code"=>65, "message"=>"error sending request for url (https://github.com/mozilla/geckodriver/releases/latest): error trying to connect: tcp connect error: Une tentative de connexion a 茅chou茅 car le parti connect 茅 n鈥檃 pas r茅pondu convenablement au-del脿 d鈥檜ne certaine dur茅e ou une connexion 茅tablie a 茅chou茅 car l鈥檋么te de connexion n鈥檃 pas r茅pondu. (os error 10060)", "driver_path"=>"", "browser_path"=>""}; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/driver_finder.rb:27:in path'
from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/local_driver.rb:49:in process_options' from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/local_driver.rb:27:in initialize_local_driver'
from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/firefox/driver.rb:42:in initialize' from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/driver.rb:53:in new'
from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/driver.rb:53:in for' from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver.rb:88:in for'
from /home/mcheav/.gem/ruby/3.2.0/gems/watir-7.3.0/lib/watir/browser.rb:46:in initialize' from ./test.rb:2738:in new'
from ./test.rb:2738:in <main>' /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/selenium_manager.rb:123:in run': Unsuccessful command executed: ["/home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.1
1.0/bin/windows/selenium-manager.exe", "--browser", "firefox", "--output", "json", "--debug"] (Selenium::WebDriver::Error::WebDriverError)
{"code"=>65, "message"=>"error sending request for url (https://github.com/mozilla/geckodriver/releases/latest): error trying to connect: tcp connect error: Une tentative de connexion a 茅chou茅 car le parti connect
茅 n鈥檃 pas r茅pondu convenablement au-del脿 d鈥檜ne certaine dur茅e ou une connexion 茅tablie a 茅chou茅 car l鈥檋么te de connexion n鈥檃 pas r茅pondu. (os error 10060)", "driver_path"=>"", "browser_path"=>""}
from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/selenium_manager.rb:42:in driver_path' from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/driver_finder.rb:28:in path'
from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/local_driver.rb:49:in process_options' from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/local_driver.rb:27:in initialize_local_driver'
from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/firefox/driver.rb:42:in initialize' from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/driver.rb:53:in new'
from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/driver.rb:53:in for' from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver.rb:88:in for'
from /home/mcheav/.gem/ruby/3.2.0/gems/watir-7.3.0/lib/watir/browser.rb:46:in `initialize'

@titusfortner
Copy link
Member

Ok, well, now that's a network/proxy issues. Something on your system/network doesn't give you access to the site we look at for determining the right driver to install.

So 3 things.

First, @bonigarcia I'm not familiar with cygwin, any idea why it might be lying to us here or what the disconnect is?

Second, figure out what your network issue is and if the network calls need to go through a proxy, or something needs to be added to an allow-list somewhere so it can work automatically like we want.

Third, in the meantime you can make it work manually by downloading the correct driver again and referencing it with Watir like this:

require 'watir'
Watir::Browser.new :firefox, service: {path: path_to_driver}

@mora-01
Copy link
Author

mora-01 commented Aug 27, 2023

sorry for the network issue, after deleting the driver at this location: D:\cygwin64_latest\cygwin64\usr\local\bin\geckodriver.exe I re-run :

require 'watir'
Watir.logger.selenium = :debug
Watir::Browser.new :firefox

Here is the output :

2023-08-27 22:12:24 INFO Selenium [:logger_info] Details on how to use and modify Selenium logger:
https://selenium.dev/documentation/webdriver/troubleshooting/logging

2023-08-27 22:12:24 DEBUG Selenium [:selenium_manager] Selenium Manager binary found at /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/bin/windows/selenium-manager.exe
2023-08-27 22:12:24 DEBUG Selenium [:selenium_manager] Executing Process ["/home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/bin/windows/selenium-manager.exe", "--browser", "firefox", "--output", "json", "--debug"]
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Checking geckodriver in PATH
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Running command: geckodriver --version
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Output: ""
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] geckodriver not found in PATH
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] firefox detected at C:\Program Files\Mozilla Firefox\firefox.exe
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Using shell command to find out firefox version
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Running command: wmic datafile where name='C:\Program Files\Mozilla Firefox\firefox.exe' get Version /value
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Output: "\r\r\n\r\r\nVersion=116.0.3.8627\r\r\n\r\r\n\r\r\n\r"
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Detected browser: firefox 116.0.3.8627
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Required driver: geckodriver 0.33.0
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Driver URL: https://github.com/mozilla/geckodriver/releases/download/v0.33.0/geckodriver-v0.33.0-win64.zip
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Driver path: C:\Users\mchea.cache\selenium\geckodriver\win64\0.33.0\geckodriver.exe
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Browser path: C:\Program Files\Mozilla Firefox\firefox.exe
2023-08-27 22:12:25 DEBUG Selenium [:driver_service] Executing Process ["C:\Users\mchea\.cache\selenium\geckodriver\win64\0.33.0\geckodriver.exe", "--port=4444"]
2023-08-27 22:12:25 DEBUG Selenium [:process] Starting process: ["C:\Users\mchea\.cache\selenium\geckodriver\win64\0.33.0\geckodriver.exe", "--port=4444"] with {[:out, :err]=>#<IO:>}
/home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/child_process.rb:57:in spawn': No such file or directory - C:\Users\mchea\.cache\selenium\geckodriver\win64\0.33.0\geckodriver.exe (Errno::ENOENT) from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/child_process.rb:57:in start'
from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/service_manager.rb:104:in start_process' from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/service_manager.rb:57:in block in start'
from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/socket_lock.rb:42:in locked' from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/service_manager.rb:55:in start'
from internal:kernel:90:in tap' from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/service.rb:92:in launch'
from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/driver.rb:334:in service_url' from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/local_driver.rb:28:in initialize_local_driver'
from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/firefox/driver.rb:42:in initialize' from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/driver.rb:53:in new'
from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/driver.rb:53:in for' from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver.rb:88:in for'
from /home/mcheav/.gem/ruby/3.2.0/gems/watir-7.3.0/lib/watir/browser.rb:46:in `initialize'

@titusfortner
Copy link
Member

@bonigarcia do you think this is related to #12612 ?

@bonigarcia
Copy link
Member

It seems everything is correct in the last logs:

2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Driver path: C:\Users\mchea.cache\selenium\geckodriver\win64\0.33.0\geckodriver.exe
2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Browser path: C:\Program Files\Mozilla Firefox\firefox.exe

@titusfortner
Copy link
Member

Right, but then we get this error:

No such file or directory - C:\Users\mchea\.cache\selenium\geckodriver\win64\0.33.0\geckodriver.exe

@bonigarcia
Copy link
Member

I suppose the problem happens because the filesystem in Cygwin (C:\Users\mchea\) is not the same as the host (/home/mcheav):

2023-08-27 22:12:25 DEBUG Selenium [:selenium_manager] Driver path: C:\Users\mchea\.cache\selenium\geckodriver\win64\0.33.0\geckodriver.exe
from /home/mcheav/.gem/ruby/3.2.0/gems/selenium-webdriver-4.11.0/lib/selenium/webdriver/common/child_process.rb:57

But that mapping is not the responsibility of Selenium, I'm afraid.

@titusfortner
Copy link
Member

@p0deje if Ruby is passing this to child process, shouldn't it figure it out?

C:\Users\mchea\.cache\selenium\geckodriver\win64\0.33.0\geckodriver.exe

@p0deje
Copy link
Member

p0deje commented Aug 29, 2023

@titusfortner Probably we need to be checking for the environment and then translating the path accordingly.

@titusfortner
Copy link
Member

@p0deje I guess I'm not sure how to take what SM is returning to us and convert it to where the system wants to see it?

@p0deje
Copy link
Member

p0deje commented Aug 29, 2023

@titusfortner I think we can just check if it's Platform.cygwin? and then use Platform.cygiwn_path to preform the conversion?

def cygwin_path(path, **opts)
flags = []
opts.each { |k, v| flags << "--#{k}" if v }
`cygpath #{flags.join ' '} "#{path}"`.strip
end

@diemol
Copy link
Member

diemol commented Nov 24, 2023

Is there something to do in this issue or did we fix it already?

@p0deje
Copy link
Member

p0deje commented Nov 24, 2023

@titusfortner I don't see this implemented anywhere in the code, do you want to do it yourself or want me to try it out?

@titusfortner
Copy link
Member

Oh, I got distracted, running tests on a fix locally now.

RevealOscar pushed a commit to RevealOscar/selenium that referenced this issue Nov 29, 2023
Copy link

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 26, 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

5 participants