lefthandedgoat / canopy

f# web automation and testing library, built on top of Selenium (friendly to c# also)
http://lefthandedgoat.github.io/canopy/
MIT License
507 stars 115 forks source link

Chromium support? #276

Closed knocte closed 8 years ago

knocte commented 8 years ago

If I run "start chrome" from my Program.fs I get:

Unhandled Exception:
OpenQA.Selenium.DriverServiceNotFoundException: The file /usr/local/bin/chromedriver does not exist. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html
  at OpenQA.Selenium.DriverService..ctor (System.String servicePath, Int32 port, System.String driverServiceExecutableName, System.Uri driverServiceDownloadUrl) <0x40c9fbe0 + 0x00217> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriverService..ctor (System.String executablePath, System.String executableFileName, Int32 port) <0x40c9fa50 + 0x00153> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService (System.String driverPath, System.String driverExecutableFileName) <0x40c72a90 + 0x0004b> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService (System.String driverPath) <0x40c6b330 + 0x0001b> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriver..ctor (System.String chromeDriverDirectory, OpenQA.Selenium.Chrome.ChromeOptions options, TimeSpan commandTimeout) <0x40c6b2d0 + 0x0001f> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriver..ctor (System.String chromeDriverDirectory, OpenQA.Selenium.Chrome.ChromeOptions options) <0x40c6b270 + 0x00037> in <filename unknown>:0 
  at canopy.core.start (canopy.BrowserStartMode b) <0x40c68cf0 + 0x004bb> in <filename unknown>:0 
  at <StartupCode$UITest>.$Program.main@ () [0x00053] in /home/andres/Documents/Code/Gatecoin/endtoendtests/UITest/Program.fs:19 
[ERROR] FATAL UNHANDLED EXCEPTION: OpenQA.Selenium.DriverServiceNotFoundException: The file /usr/local/bin/chromedriver does not exist. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html
  at OpenQA.Selenium.DriverService..ctor (System.String servicePath, Int32 port, System.String driverServiceExecutableName, System.Uri driverServiceDownloadUrl) <0x40c9fbe0 + 0x00217> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriverService..ctor (System.String executablePath, System.String executableFileName, Int32 port) <0x40c9fa50 + 0x00153> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService (System.String driverPath, System.String driverExecutableFileName) <0x40c72a90 + 0x0004b> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService (System.String driverPath) <0x40c6b330 + 0x0001b> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriver..ctor (System.String chromeDriverDirectory, OpenQA.Selenium.Chrome.ChromeOptions options, TimeSpan commandTimeout) <0x40c6b2d0 + 0x0001f> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriver..ctor (System.String chromeDriverDirectory, OpenQA.Selenium.Chrome.ChromeOptions options) <0x40c6b270 + 0x00037> in <filename unknown>:0 
  at canopy.core.start (canopy.BrowserStartMode b) <0x40c68cf0 + 0x004bb> in <filename unknown>:0 
  at <StartupCode$UITest>.$Program.main@ () [0x00053] in /home/andres/Documents/Code/Gatecoin/endtoendtests/UITest/Program.fs:19 

Many instructions around the web tell me download a binary... but, hey, I'm using chromium, not chrome, so the equivalent in my world, I guess, is to apt-get install chromium-chromedriver, but I still get the same error after I install this.

So I tried start chromium instead of start chrome and it doesn't compile obviously ("The value or constructor chromium is not defined").

Note: the chromium-chromedriver package installs the executable in /usr/lib/chromium-browser/chromedriver , maybe you should add this search path in canopy too when the /usr/local one is not found?

lefthandedgoat commented 8 years ago

I have never tried using chromium and I don't have a linux VM handy at the moment.

Try this

chromeDir <- "/usr/lib/chromium-browser/chromedriver"

And see if it works. If it does not I will try to figure it out tomorrow.

knocte commented 8 years ago

chromeDir <- "/usr/lib/chromium-browser/chromedriver"

That doesn't work. But this:

chromeDir <- "/usr/lib/chromium-browser"

does! Thanks!

(Would be nice to include this in canopy somehow, allowing start chromium this way.)

lefthandedgoat commented 8 years ago

I can add this tomorrow

On Jul 14, 2016 11:30 PM, "Andres G. Aragoneses" notifications@github.com wrote:

chromeDir <- "/usr/lib/chromium-browser/chromedriver"

That doesn't work. But this:

chromeDir <- "/usr/lib/chromium-browser"

does! Thanks!

(Would be nice to include this in canopy somehow, allowing start chromium this way.)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lefthandedgoat/canopy/issues/276#issuecomment-232857420, or mute the thread https://github.com/notifications/unsubscribe-auth/AAsQ6YAz7l56583VBVexnT78vTnOcizeks5qVwzngaJpZM4JNEHS .

knocte commented 8 years ago

Great thanks!

On 15 July 2016 at 12:41, Chris Holt notifications@github.com wrote:

I can add this tomorrow

On Jul 14, 2016 11:30 PM, "Andres G. Aragoneses" <notifications@github.com

wrote:

chromeDir <- "/usr/lib/chromium-browser/chromedriver"

That doesn't work. But this:

chromeDir <- "/usr/lib/chromium-browser"

does! Thanks!

(Would be nice to include this in canopy somehow, allowing start chromium this way.)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub < https://github.com/lefthandedgoat/canopy/issues/276#issuecomment-232857420 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AAsQ6YAz7l56583VBVexnT78vTnOcizeks5qVwzngaJpZM4JNEHS

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lefthandedgoat/canopy/issues/276#issuecomment-232858366, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUOJ6sO3yX7v7OhnS0zoiPAvACYyb-xks5qVw9qgaJpZM4JNEHS .

lefthandedgoat commented 8 years ago

You can download the latest nuget with the fix here:

https://www.nuget.org/packages/canopy/0.9.57

I didn't have a chance to test it, but it 'should work' =)

knocte commented 8 years ago

I've tried 0.9.57 today and tested this, but still doesn't work. The error is not the same as the error I posted in my first message up here, see:

Unhandled Exception:
OpenQA.Selenium.DriverServiceNotFoundException: The file /usr/bin/chromedriver does not exist. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html
  at OpenQA.Selenium.DriverService..ctor (System.String servicePath, Int32 port, System.String driverServiceExecutableName, System.Uri driverServiceDownloadUrl) <0x416d5a10 + 0x00217> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriverService..ctor (System.String executablePath, System.String executableFileName, Int32 port) <0x416d5880 + 0x00153> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService (System.String driverPath, System.String driverExecutableFileName) <0x416cfb20 + 0x0004b> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService (System.String driverPath) <0x416c8850 + 0x0001b> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriver..ctor (System.String chromeDriverDirectory, OpenQA.Selenium.Chrome.ChromeOptions options, TimeSpan commandTimeout) <0x416c87f0 + 0x0001f> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriver..ctor (System.String chromeDriverDirectory, OpenQA.Selenium.Chrome.ChromeOptions options) <0x416c8790 + 0x00037> in <filename unknown>:0 
  at canopy.core.start (canopy.BrowserStartMode b) <0x416c6c70 + 0x006c7> in <filename unknown>:0 
  at <StartupCode$UITest>.$Program.main@ () <0x41699d50 + 0x002e3> in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: OpenQA.Selenium.DriverServiceNotFoundException: The file /usr/bin/chromedriver does not exist. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html
  at OpenQA.Selenium.DriverService..ctor (System.String servicePath, Int32 port, System.String driverServiceExecutableName, System.Uri driverServiceDownloadUrl) <0x416d5a10 + 0x00217> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriverService..ctor (System.String executablePath, System.String executableFileName, Int32 port) <0x416d5880 + 0x00153> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService (System.String driverPath, System.String driverExecutableFileName) <0x416cfb20 + 0x0004b> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService (System.String driverPath) <0x416c8850 + 0x0001b> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriver..ctor (System.String chromeDriverDirectory, OpenQA.Selenium.Chrome.ChromeOptions options, TimeSpan commandTimeout) <0x416c87f0 + 0x0001f> in <filename unknown>:0 
  at OpenQA.Selenium.Chrome.ChromeDriver..ctor (System.String chromeDriverDirectory, OpenQA.Selenium.Chrome.ChromeOptions options) <0x416c8790 + 0x00037> in <filename unknown>:0 
  at canopy.core.start (canopy.BrowserStartMode b) <0x416c6c70 + 0x006c7> in <filename unknown>:0 
  at <StartupCode$UITest>.$Program.main@ () <0x41699d50 + 0x002e3> in <filename unknown>:0
knocte commented 8 years ago

Oh, my bad, the problem is that I was still using ChromeWithOptions, do you mind adding ChromiumWithOptions too?

lefthandedgoat commented 8 years ago

Sure!

lefthandedgoat commented 8 years ago

You can download here:

https://www.nuget.org/packages/canopy/0.9.60

You still need to pass Chrome Options as there is no Chromium options in selenium.

knocte commented 8 years ago

Cool thanks! (But did you forget to push? I was curious to look at how you added it, but can't find the change :) )

lefthandedgoat commented 8 years ago

I hadn't pushed. The change is now linked below your comment.

knocte commented 8 years ago

Cool thanks! Works great.