2013-01-10 31 views
1

我正在使用selenium-webdriver來自動化網絡瀏覽器相關的任務。但是當我做了以下獲取大塊messgaes如下。爲什麼這樣,你能告訴我嗎?以及如何抑制它的任何想法?從selenium-webdriver獲取不需要的消息,如何隱藏該消息?

irb(main):001:0> require "selenium-webdriver" 
=> true 
irb(main):002:0> driver=Selenium::WebDriver.for :firefox 
*** LOG addons.manager: Application has been upgraded 
*** LOG addons.xpi: startup 
*** WARN addons.xpi: Ignoring missing add-on in C:\Program Files\SearchPredict\P 
RFireFox 
*** WARN addons.xpi: Ignoring missing add-on in C:\Program Files\SpeedBit Video 
Downloader\SPFireFox 
*** WARN addons.xpi: Ignoring missing add-on in C:\Program Files\Web Assistant\F 
irefox 
*** WARN addons.xpi: Ignoring missing add-on in C:\Program Files\Iminent\webboos 
[email protected] 
*** LOG addons.xpi: Skipping unavailable install location app-system-local 
*** LOG addons.xpi: Skipping unavailable install location app-system-share 
*** LOG addons.xpi: checkForChanges 
*** LOG addons.xpi-utils: Opening database 
*** LOG addons.xpi-utils: Creating database schema 
*** LOG addons.xpi: New add-on [email protected] installed in app-profile 
*** Blocklist::_loadBlocklistFromFile: blocklist is disabled 
*** LOG addons.xpi: New add-on {F17C1572-C9EC-4e5c-A542-D05CBB5C5A08} installed 
in winreg-app-user 
*** LOG addons.xpi: New add-on [email protected] installed in app-global 
*** WARN addons.xpi: Add-on is invalid: Error: Directory C:\Program Files\Mozill 
a Firefox\extensions\[email protected] does not contain a valid install manife 
st 
*** WARN addons.xpi: Could not uninstall invalid item from locked install locati 
on 
*** LOG addons.xpi: New add-on {1FD91A9C-410C-4090-BBCC-55D3450EF433} installed 
in app-global 
*** LOG addons.xpi: New add-on {972ce4c6-7e08-4474-a285-3208198ce6fd} installed 
in app-global 
*** LOG addons.xpi: New add-on [email protected] installed in winreg-app- 
global 
*** LOG addons.xpi: New add-on [email protected] installed in winreg-app-global 
*** LOG addons.xpi: New add-on [email protected] installed in winreg-a 
pp-global 
*** LOG addons.xpi: New add-on [email protected] installed in winreg-app-global 
*** LOG addons.xpi: Updating database with changes to installed add-ons 
*** LOG addons.xpi-utils: Updating add-on states 
*** LOG addons.xpi-utils: Writing add-ons list 
*** LOG addons.manager: shutdown 
*** LOG addons.xpi: shutdown 
*** LOG addons.xpi-utils: shutdown 
*** LOG addons.xpi-utils: Database closed 
*** LOG addons.xpi: startup 
*** WARN addons.xpi: Ignoring missing add-on in C:\Program Files\SearchPredict\P 
RFireFox 
*** WARN addons.xpi: Ignoring missing add-on in C:\Program Files\SpeedBit Video 
Downloader\SPFireFox 
*** WARN addons.xpi: Ignoring missing add-on in C:\Program Files\Web Assistant\F 
irefox 
*** WARN addons.xpi: Ignoring missing add-on in C:\Program Files\Iminent\webboos 
[email protected] 
*** LOG addons.xpi: Skipping unavailable install location app-system-local 
*** LOG addons.xpi: Skipping unavailable install location app-system-share 
*** LOG addons.xpi: checkForChanges 
*** LOG addons.xpi: No changes found 
=> #<Selenium::WebDriver::Driver:0x..fbe37f7d8 browser=:firefox> 
irb(main):003:0> 
+0

你看着辦吧?我有完全相同的問題。 – Jaepetto

+0

@Jaepetto我還沒有。你可以重新打開[張貼](http://stackoverflow.com/questions/14321645/how-the-description- mentioned-hashmethods-work-in-ruby#comment19905772_14321645)或投票! –

回答

2

您的Firefox配置文件正在檢查啓動時的加載項。當我在Windows中開發基於Ruby的Selenium測試時,我習慣了這個消息。切換到Mac OS X,然後再切換到Ubuntu,似乎爲我處理了這個問題,但由於這有點極端,所以您可以採取一種解決方法。

首先,您需要在Firefox中設置一個新的配置文件,該配置文件不會在啓動時檢查附件。以下是您需要在該配置文件中設置的選項的線索:link。下面是Mozilla的關於如何使用Firefox的配置文件管理器的參考,如果你需要它:link

在Ruby代碼中,你有這樣的事情

然後:

driver = Selenium::WebDriver.for :firefox 

您需要將選項添加到告訴Webdriver使用哪個配置文件。它最終會變成這樣,而是:

driver = Selenium::WebDriver.for :firefox, :profile => "selenium_testing" 

(只需更換「selenium_testing」不管你已經命名了新的配置文件。)

您應該然後能夠啓動火狐沒有所有這些刺激性警告。

1

我通過將Firefox升級到較舊版本解決了此問題(與Selenium-WebDriver配合良好)。就我而言,我不得不降級到Firefox 18這個版本與Selenium 2.27工作

退房older versions of Firefox