Coder Social home page Coder Social logo

Comments (22)

philipfong avatar philipfong commented on August 17, 2024 2

@flavorjones sorry if I was unclear. What I was getting at was that using version 1.2.0 on Windows 7 works just fine whereas the latest version of the gem does not.

If you need steps to reproduce, simply run gem install chromedriver-helper then a chromedriver-update and failures will happen when attempting to run tests on Windows 7. However on 1.2.0 things work just fine.

I'm with @shbeavers in pretty much asking "what changed?"

from chromedriver-helper.

cmetadata avatar cmetadata commented on August 17, 2024 1

The only solution for me is to use 1.2.0.

from chromedriver-helper.

cmetadata avatar cmetadata commented on August 17, 2024 1

I read changing this

     def assert_executable(path)
        assert_file(path)

        return if File.executable? path
        raise Error::WebDriverError, "not executable: #{path.inspect}"
      end

To this

     def assert_executable(path)
        assert_file(path)

        return nil
        raise Error::WebDriverError, "not executable: #{path.inspect}"
      end

Also addresses the issue. So maybe that's a place to start?

from chromedriver-helper.

flavorjones avatar flavorjones commented on August 17, 2024

Hi @kevinrood, thanks for opening this issue.

I'm not sure what you mean here, though, as chromedriver-helper has supported Windows forever. Can you provide more information on what's not working for you, as well as information on what version of Windows, Ruby and chromedriver-helper you're using?

from chromedriver-helper.

Christopher-Steel avatar Christopher-Steel commented on August 17, 2024

Hello @flavorjones,

TL;DR: your wrapper script is never called by Selenium on Windows because it is named chromedriver instead of chromedriver.exe

First of all, very nice gem, I was happy to find it. It's worked perfectly for me both on Linux and on Mac OS. However, on Windows it does not work as smoothly.

I'm on Windows 7, using Git Bash to run the bundle install command.
This is my ruby version:

$ ruby --version
ruby 2.1.7p400 (2015-08-18 revision 51632) [i386-mingw32]

And here is the error printed when I try to run my ruby app after bundle install:

C:/Ruby21/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/chrome/service.rb:37:in `executable_path': Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. (Selenium::WebDriver::Error::WebDriverError)
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/chrome/service.rb:50:in `default_service'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/chrome/bridge.rb:33:in `initialize'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/common/driver.rb:56:in `new'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver/common/driver.rb:56:in `for'
        from C:/Ruby21/lib/ruby/gems/2.1.0/gems/selenium-webdriver-2.47.1/lib/selenium/webdriver.rb:86:in `for'
        from C:/Users/testaccount/Documents/roach/session.rb:33:in `chrome_open'
        from C:/Users/testaccount/Documents/roach/session.rb:13:in `initialize'
        from C:/Users/testaccount/Documents/roach/roach_test.rb:17:in `new'
        from C:/Users/testaccount/Documents/roach/roach_test.rb:17:in `<main>'
UPDATE:

Currently testing on Windows 8, with cmd.exe and the same version of Ruby, I'll let you know the results when I'm done

UPDATE 2:

I had the exact same result on Windows 8 using cmd.exe

UPDATE 3:

I foraged around and ended up finding that a non windows version of chromedriver got installed, it was named chromedriver without the .exe and when I tried renaming it to add the .exe, it just crashed on load. I grabbed the file manually from google code and replaced the one installed by your gem and it fixed the problem.

I was curious about the source of this problem so I tried printing RbConfig::CONFIG["host_os"] in both Git Bash and cmd.exe and got
mingw32
in both cases

I'll do further investigation if I have the time for it, maybe even a pull request if I find the cause.

UPDATE 4:

My previous conclusion was wrong. The file I found was not chromedriver, it was the ruby script called chromedriver that gets copied to the ruby bin path when installing your gem. This means that there is a problem with the Chromedriver::Helper::run itself.
From the looks of it, it should be putting chromedriver in "~/.chromedriver-helper", however no directory or file is created when the code is run. I'll keep the investigation going.

UPDATE 5:

Alright, I've narrowed it down.

The way you seen to have build this is by having a ruby script named chromedriver copied to the users ruby bin folder through Gem::Specification::executables. This script then checks in ~/.chromedriver-helper/ to see if you already have the chromedriver binary and if you haven't it downloads it. Basically your script is a cached downloader for chromedriver.

While this is clever because it means that your file gets called when Selenium or other tries to use chromedriver, it does not work with Selenium on Windows because Selenium tries to use chromedriver.exe, not chromedriver. And while your script correctly accounts for windows by looking for chromedriver.exe, your script is never called because it isn't named chromedriver.exe

from chromedriver-helper.

aaronbriel avatar aaronbriel commented on August 17, 2024

I'm seeing this same issue on Windows 10. I've installed chromedriver-helper via gem install. Even with chromedriver.exe in my PATH I see the following error when attempting to run:
Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. (Selenium::WebDriver::Error::WebDriverError)

When I added ~/.chromedriver-helper/win to my PATH this resolved the issue.

from chromedriver-helper.

flavorjones avatar flavorjones commented on August 17, 2024

I've reproduced this, and I've put a failing integration test on the branch flavorjones-19-failing-windows-integration-test.

Unfortunately, I don't know how to make this test pass on Windows, and so I need your help.

Currently if I put a ruby script in bin/chromedriver.exe, Windows fails to run it (I see the error as Errno::EINVAL: Invalid argument - "chromedriver.exe" -v). I could make this a powershell script, but it would only work if people had lowered their security settings.

Any ideas on how to make that test pass?

from chromedriver-helper.

flavorjones avatar flavorjones commented on August 17, 2024

Bumping this, anyone have an idea on what a solution looks like?

from chromedriver-helper.

matti avatar matti commented on August 17, 2024

could chromedriver add that directory to PATH ?

from chromedriver-helper.

flavorjones avatar flavorjones commented on August 17, 2024

@matti The question of whether it's in the users $PATH doesn't affect the fact that default Windows security settings will not allow running a powershell script.

However, one other potential solution I haven't explored is using Selenium::WebDriver::Chrome.driver_path which might allow us to run powershell.exe with appropriate args to fire up a script.

from chromedriver-helper.

flavorjones avatar flavorjones commented on August 17, 2024

Nope, recent versions of Selenium::WebDriver will only accept executables as an argument to driver_path=.

Still looking for a solution here.

from chromedriver-helper.

hajarNasr avatar hajarNasr commented on August 17, 2024

@flavorjones Thank you for your quick response. I am new to codding but since there's not a solution yet I made Platform.assert_executable path in drive_path in Chrome.rb as a comment, so it doesn't check whether or not chromedriver-helper is executable anymore. And rake test worked but I am not sure if that would break another part in the code?

from chromedriver-helper.

philipfong avatar philipfong commented on August 17, 2024

Hey there. I'm on a Windows 7 box and am able to get chromedriver to work on version 1.2.0. However on the latest version of the gem, I get the "not executable" error.

On 1.2.0, I'm able to simply go through a bundle install, followed by a chromedriver-update. I'm able to run tests using the oddly versioned 70.0.3538.16. Strangely, forcing 2.42 does NOT work and will produce an error.

It looks like on 1.2.0, chromedriver.exe is installed to C:\Users\philipfong.chromedriver-helper\70.0.3538.16\win directory. Is there a reason that an .exe is not used for the latest version of this gem?

from chromedriver-helper.

flavorjones avatar flavorjones commented on August 17, 2024

@philipfong I'm not sure what you're asking, and I'm sorry for that.

This issue is describing a problem where, on modern Windowses (which I don't believe includes Windows 7) do not allow the execution of powershell scripts (as a matter of security policy), and so the "shim" script that this gem uses will not execute.

You seem to be describing a different problem, and so I'd like to ask that you open a new issue, please, and start from the beginning when describing what you're seeing. Thank you.

from chromedriver-helper.

shbeavers avatar shbeavers commented on August 17, 2024

Adding chromedriver.exe to the C:\Windows\System32\ directory gets chromedriver working. However, this doesn't address why the chromedriver-helper installer isn't working anymore.

I've seen this problem on two Windows 10 machines where only recently has Ruby been installed along with a very recent version of chromedriver-helper. With systems that were set up in August, chomedriver-helper's install of Chromedriver functioned perfectly. These systems continued to work after updating to the latest versions of chromedriver-helper and chromedriver. The initial installation installed a .chromedriver-helper folder in the C:\Users\UserName directory with chromedriver.exe inside it a couple of folders deep (~\2.40\win).

So I'm inclined to ask "what changed?" in the past couple of months to break what had been working. Meanwhile, I'm content with the simple workaround of manually placing chromedriver.exe in a PATH location.

from chromedriver-helper.

flavorjones avatar flavorjones commented on August 17, 2024

@shbeavers Thanks for your comment. I've tried to describe the issue above, and it's not due to anything that's changed in the past few months. This issue dates to 2015, and may or may not manifest depending on what security settings are present on your particular windows machines. Pre-Windows-10 this may have worked depending on group policy settings, etc.

Please also note that placing chromedriver.exe in your PATH means you really don't need this gem! Which is great if you're happy with that solution.

from chromedriver-helper.

shbeavers avatar shbeavers commented on August 17, 2024

from chromedriver-helper.

flavorjones avatar flavorjones commented on August 17, 2024

Hi all,

If something's not working that's changed since v1.2.0 then can someone please open a new ticket and we can dig in there? Again, this ticket was opened to describe an issue related to Windows 10 file permissioning that's existed for several years, and v1.2.0 was released earlier in Feb 2018.

Having a second (or third) issue here makes this information harder to find, so thank you in advance for helping me out and opening a new issue.

from chromedriver-helper.

flavorjones avatar flavorjones commented on August 17, 2024

@whatisc please see my request at #19 (comment)

from chromedriver-helper.

cmetadata avatar cmetadata commented on August 17, 2024

I was under the impression it's the same issue? But maybe not.

from chromedriver-helper.

GrayStrider avatar GrayStrider commented on August 17, 2024

I read changing this

     def assert_executable(path)
        assert_file(path)

        return if File.executable? path
        raise Error::WebDriverError, "not executable: #{path.inspect}"
      end

To this

     def assert_executable(path)
        assert_file(path)

        return nil
        raise Error::WebDriverError, "not executable: #{path.inspect}"
      end

Also addresses the issue. So maybe that's a place to start?

Had this problem, worked. Thanks

from chromedriver-helper.

flavorjones avatar flavorjones commented on August 17, 2024

I'm going to close this issue, as the gem is being deprecated in favor of webdrivers, see #83.

from chromedriver-helper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.