subaru-hello / Zeroken

一軒目に飲むお酒と飲む順番を提供するアプリ
5 stars 0 forks source link

【System Spec】Selenium::WebDriver::Error::WebDriverErrorを解消させたい #108

Closed subaru-hello closed 2 years ago

subaru-hello commented 2 years ago

発生しているエラー

  3) ユーザー登録 ユーザー情報に不備がある場合 新規登録に失敗する
     Got 0 failures and 2 other errors:

     3.1) Failure/Error: visit '/register'

          Selenium::WebDriver::Error::WebDriverError:
            Unable to find chromedriver. Please download the server from
            https://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH.
            More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver.

試したこと

  1. この記事を参考にしてgem install webdriversを実行
    Fetching webdrivers-5.0.0.gem
    Successfully installed webdrivers-5.0.0
    Parsing documentation for webdrivers-5.0.0
    Installing ri documentation for webdrivers-5.0.0
    Done installing documentation for webdrivers after 0 seconds
    1 gem installed
  2. この記事には、homebrewを使ってインストールすべしと書いてあり、試してみましたが、すでにインストールされていたので違うようです。
    brew install chromedriver
    Warning: Cask 'chromedriver' is already installed.

3.下記コマンドをirbで実行。selenium-web-driverはインストールされていることを確認。

irb(main):001:0> require 'selenium-webdriver'
=> true
irb(main):002:0> driver = Selenium::WebDriver.for :chrome
Traceback (most recent call last):
        1: from (irb):2
Selenium::WebDriver::Error::WebDriverError (Unable to find chromedriver. Please download the server from)
https://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH.
More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver.

https://blog.naichilab.com/entry/mac-chromedriver

subaru-hello commented 2 years ago

which chromedriverをターミナルに打ったところ、chromedriverが見つからないコマンドが吐き出された。

  1. こちらのURLから、macos用のchromedriverを直接ダウンロード
  2. macのbin配下にコピーアンドペースト
  3. tarminalでwhich chromedriverを打ったところ、パスが見つかる
  4. 再度bundle exec rspecを実行したところ解決した。