2013-09-24 5 views
0

나는 다음과 같은 한 당신의 보석 및 Windows 7에서 작업을 얻으려고 거부 얻을 코드 :browsermob - 프록시 .har 파일과 권한은

require 'selenium/webdriver' 
require 'browsermob/proxy' 

server = BrowserMob::Proxy::Server.new('C:/Ruby193/lib/ruby/gems/1.9.1/gems/browsermob-proxy-0.1.3/lib/browsermob-proxy.rb') #=> #<BrowserMob::Proxy::Server:0x000001022c6ea8 ...> 
server.start 

proxy = server.create_proxy #=> #<BrowserMob::Proxy::Client:0x0000010224bdc0 ...> 

profile = Selenium::WebDriver::Firefox::Profile.new #=> #<Selenium::WebDriver::Firefox::Profile:0x000001022bf748 ...> 
profile.proxy = proxy.selenium_proxy 

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

proxy.new_har "google" 
driver.get "http://google.com" 

har = proxy.har #=> #<HAR::Archive:0x-27066c42d7e75fa6> 
har.entries.first.request.url #=> "http://google.com" 
har.save_to "/tmp/google.har" 

proxy.close 
driver.quit 

얻을 오류 : 나는 창에서 사용 권한이 없음을 생각

C:/Ruby193/lib/ruby/gems/1.9.1/gems/browsermob-proxy-0.1.3/lib/browsermob/proxy/server.rb:16:in ´initialize' : Permission denied - not executable: C:/Ruby193/lib/ruby/gems/1.9.1/gems/browsermob-proxy-0.1.3/lib/browsermob-proxy.rb (Errno::EACCES) 
from gethar.rb:in 'new' 
from gethar.rb:in '<main>' 

리눅스처럼? 도움이 필요하십니까

답변

1

오류 메시지가 잘못된 것입니다. 이것은 사용 권한 문제가 아닙니다. 보석과는 별도로 browsermob bat 파일을 가리켜 야합니다.

당신은 여기에서 다운로드 할 수 있습니다 http://bmp.lightbody.net/

그런 다음 파일 위치를 가리 광산은 다음과 같습니다

server = BrowserMob::Proxy::Server.new('C:/browsermob-proxy/bin/browsermob-proxy.bat') 

문제를 수정해야한다고.

관련 문제