質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Q&A

1回答

2233閲覧

ruby クロール 全画面表示

LukeFukuda

総合スコア81

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

0グッド

0クリップ

投稿2016/03/18 05:45

http://www.blacklistalert.org/http://www.blacklistalert.org/を全画面で取得したいのですがエラーがでてしまいます。

エラー

DEPRECATED: #default_wait_time= is deprecated, please use #default_max_wait_time= instead DEPRECATED: #default_wait_time= is deprecated, please use #default_max_wait_time= instead :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/binary.rb:150:in `path': Could not find Firefox binary (os=windows). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path= (Selenium::WebDriver::Error::WebDriverError) from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/binary.rb:79:in `execute' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/binary.rb:53:in `start_with' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:82:in `start' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:54:in `block in launch' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/socket_lock.rb:43:in `locked' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:51:in `launch' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/bridge.rb:43:in `initialize' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/driver.rb:53:in `new' from D:/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/driver.rb:53:in `for' from D:/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver.rb:84:in `for' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.6.2/lib/capybara/selenium/driver.rb:13:in `browser' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.6.2/lib/capybara/selenium/driver.rb:45:in `visit' from D:/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.6.2/lib/capybara/session.rb:232:in `visit' from D:/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.6.2/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>' from :/Ruby/youcan/iop/blacklist:14:in `domain_check' from :/Ruby/youcan/iop/blacklist:32:in `<main>' [Finished in 24.121s]D:/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/binary.rb:150:in `path': Could not find Firefox binary (os=windows). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path= (Selenium::WebDriver::Error::WebDriverError) from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/binary.rb:79:in `execute' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/binary.rb:53:in `start_with' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:82:in `start' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:54:in `block in launch' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/socket_lock.rb:43:in `locked' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:51:in `launch' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/bridge.rb:43:in `initialize' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/driver.rb:53:in `new' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/driver.rb:53:in `for' from D:/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver.rb:84:in `for' from D:/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.6.2/lib/capybara/selenium/driver.rb:13:in `browser' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.6.2/lib/capybara/selenium/driver.rb:45:in `visit' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.6.2/lib/capybara/session.rb:232:in `visit' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.6.2/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>' from /blacklist:14:in `domain_check' from /blacklist:32:in `<main>'

ruby

1# -*- coding: utf-8 -*- 2require 'capybara' 3require 'capybara/dsl' 4require 'selenium-webdriver' 5 6Capybara.current_driver = :selenium 7Capybara.app_host = "http://www.blacklistalert.org/" 8Capybara.default_wait_time = 20 9 10module Crawler 11 class BlackListAlert 12 include Capybara::DSL 13 def domain_check(target) 14 visit('/') 15 fill_in "q", :with => target 16 click_button "check" 17 within(:xpath, "/html/body/center/font/form") do 18 alert_notice if page.has_content?('Listed!') 19 end 20 21 page.save_screenshot('screenshot.png') 22 end 23 24 def alert_notice 25 # アラート処理 26 puts "Alert!!" 27 end 28 end 29end 30 31crawler = Crawler::BlackListAlert.new 32crawler.domain_check('mail.google.com') 33

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

:/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/binary.rb:150:in `path': Could not find Firefox binary (os=windows). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path= (Selenium::WebDriver::Error::WebDriverError)

エラーメッセージを読むとFirefoxが見つからないとなってます。

  1. Firefoxがインストールされているか確認せよ。
  2. パスが通ってるか確認せよ。

というメッセージです。

その点はどうですか?

投稿2016/03/18 05:57

編集2016/03/18 06:21
NCC1701

総合スコア1680

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

LukeFukuda

2016/03/18 06:07

firefox-0.1.0がインストールされています。
NCC1701

2016/03/18 06:48 編集

パスを設定してください。環境が不明なので一例です。 Selenium::WebDriver::Firefox::Binary.path="/Applications/Firefox.app/Contents/MacOS/firefox" この辺かな? Selenium::WebDriver::Firefox::Binary.path='C:\Program Files (x86)\Mozilla Firefox\firefox.exe'
LukeFukuda

2016/03/18 11:32 編集

どうやらインストールしたgem install firefoxはfirefox(検索エンジン)ではなかったようです。ただしいfirefoxをインストールしたら、firefoxが自動で開いてfirefoxにエラーがでました。 アドレスの書式が正しくありません URL が正しくないため、読み込めませんでした。 Web のアドレスは通常 http://www.example.com/ のようなものになります。 円記号やバックスラッシュ (\) ではなく、スラッシュ (/) が使われているか確認してください。
NCC1701

2016/03/18 11:27

貴殿の実行環境(OSやらCPUやら)がわからないので,Binary.pathの指定は例です。 Selenium::WebDriver::Firefox::Binary.pathで検索して,自身の環境にあったパスを設定してみてください。 何れにしても,エラーからわかるのは,上述した1.2.です(引用した部分だけでも読んでみれば簡単な英語なので理解できるはずです。)
LukeFukuda

2016/03/18 11:38 編集

windows 10 64bitを使っています。テキストエディターはatomを使っています。 エラーはatomには DEPRECATED: #default_wait_time= is deprecated, please use #default_max_wait_time= instead :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:90:in `connect_until_stable': unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055) (Selenium::WebDriver::Error::WebDriverError) from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:55:in `block in launch' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/socket_lock.rb:43:in `locked' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/launcher.rb:51:in `launch' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/firefox/bridge.rb:43:in `initialize' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/driver.rb:53:in `new' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver/common/driver.rb:53:in `for' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.53.0/lib/selenium/webdriver.rb:84:in `for' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.6.2/lib/capybara/selenium/driver.rb:13:in `browser' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.6.2/lib/capybara/selenium/driver.rb:45:in `visit' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.6.2/lib/capybara/session.rb:232:in `visit' from :/Ruby/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/capybara-2.6.2/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>' from :/Ruby/youcan/iop/blacklist:14:in `domain_check' from :/blacklist:32:in `<main>' と表示されて、 firefoxには、 URL が正しくないため、読み込めませんでした。 Web のアドレスは通常 http://www.example.com/ のようなものになります。 円記号やバックスラッシュ (\) ではなく、スラッシュ (/) が使われているか確認してください。 と表示されます。
NCC1701

2016/03/18 14:22

`connect_until_stable': unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055) (Selenium::WebDriver::Error::WebDriverError) で検索したうちの一つです。参考にしてください。それと,エラーメッセージを読む訓練も。 http://dice-k-0.blogspot.jp/2011/10/selenium-1.html
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問