2016-11-21 3 views
1

안녕하세요. 모든 리디렉션이 발생했을 때이를 포착하고 싶습니다. 먼저 example.com으로 이동 한 다음 example3.com으로 리디렉션한다고 가정합니다.watir webdriver browsermob/proxy har 파일이 거의 비어 있음

저는 watir webdriver와 browsermob/proxy를 사용하고 있습니다. google.com을 사용해 보았는데 리디렉션이되지 않지만 har 파일은 내가 얻는 것보다 훨씬 큽니다.

HIER 코드입니다 :

server = BrowserMob::Proxy::Server.new("/home/da/Downloads/browsermob-proxy-2.0.0/bin/browsermob-proxy") #=> #<BrowserMob::Proxy::Server:0x000001022c6ea8 ...> 
     server.start 
    @@proxy = server.create_proxy(9090) 
     puts @@proxy.inspect 
    profile = Selenium::WebDriver::Firefox::Profile.new 
     puts "going on #{dv}" 
    profile['general.useragent.override'] = dv['useragent'] 
     #'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:27.0) Gecko/20100101 Firefox/27.0'#device['useragent'] 
    puts dv['useragent'] 
    profile.proxy = Selenium::WebDriver::Proxy.new :http => 'localhost:9090', :ssl => 'localhost:9090'#9091 
    time = Time.now.to_i #Time.now.getutc 
    puts APP_ROOT 
    @@proxy.new_har time 
    @@b = Watir::Browser.new :firefox, :profile => profile 
     @@har = @@proxy.har #=> #<HAR::Archive:0x-27066c42d7e75fa6> 
     #har.entries.first.request.url 
     #har.entries.first.request.url #=> "http://google.com" 
     @@b.goto "google.com" 
     puts @@har.inspect 
     @@har.save_to "#{APP_ROOT}/har/google.har" 
     exit 

이 내가 exmple2.com와 HAR 파일을 많이 제공하지 않습니다에 example1.com 위에서 언급 한 같은 리디렉션과 노력

{"log":{"version":"1.2","creator":{"name":"BrowserMob Proxy","version":"2.0","comment":""},"browser":{"name":"IE","version":"11.0","comment":""},"pages":[{"id":"1479767515","startedDateTime":"2016-11-21T23:31:56.561+01:00","title":"","pageTimings":{"comment":""},"comment":""}],"entries":[{"pageref":"1479767515","startedDateTime":"2016-11-21T23:32:02.146+01:00","request":{"method":"GET","url":"https://tiles.services.mozilla.com/v3/links/fetch/en-US/release","httpVersion":"HTTP/1.1","cookies":[],"headers":[],"queryString":[],"headersSize":370,"bodySize":0,"comment":""},"response":{"status":303,"statusText":"SEE OTHER","httpVersion":"HTTP/1.1","cookies":[],"headers":[],"content":{"size":0,"mimeType":"text/html; charset=utf-8","comment":""},"redirectURL":"","headersSize":266,"bodySize":0,"comment":""},"cache":{},"timings":{"blocked":101,"dns":266,"connect":238,"send":1,"wait":205,"receive":832,"ssl":0,"comment":""},"serverIPAddress":"52.32.150.180","comment":"","time":1643},{"pageref":"1479767515","startedDateTime":"2016-11-21T23:32:02.791+01:00","request":{"method":"POST","url":"https://location.services.mozilla.com/v1/country?key=7e40f68c-7938-4c5d-9f95-e61647c213eb","httpVersion":"HTTP/1.1","cookies":[],"headers":[],"queryString":[{"name":"key","value":"7e40f68c-7938-4c5d-9f95-e61647c213eb"}],"headersSize":419,"bodySize":2,"comment":""},"response":{"status":200,"statusText":"OK","httpVersion":"HTTP/1.1","cookies":[],"headers":[],"content":{"size":49,"mimeType":"application/json; charset=UTF-8","comment":""},"redirectURL":"","headersSize":227,"bodySize":49,"comment":""},"cache":{},"timings":{"blocked":0,"dns":9,"connect":45,"send":17,"wait":60,"receive":511,"ssl":0,"comment":""},"serverIPAddress":"52.19.86.22","comment":"","time":642}],"comment":""}} 

무엇을 얻을

확인 여기에 몇 가지 테스트 결과 : :(

는 여기에 내가 미리 형성 몇 가지 테스트입니다 : 파이어 폭스 49 2.0.0 모든

파이어 폭스 47 개 2.1.2 작품에서 작동하지 않는 모든 파이어 폭스 (48) 2.1.2에서 작동하지 않는 모든 파이어 폭스 49 2.1.2에서 작동하지 않습니다하지만하겠다이다 작은 파이어 폭스 47 2.0.0 작업하겠다 파일은 더 큰 파이어 폭스 47 2.1.0가하겠다는 파이어 폭스 47 개 2.1.1 작품 큰 중간 인 작품이며

가장 큰이 그럼 난 파이어 폭스 (46)도 테스트 같은 결과를 얻었다이다. ...

나는 몇 년 전에도 동일한 코드를 사용하여 리디렉션을 얻었으며 지금은 얻을 수 있습니다. (

답변

0

Browsermob을 통해 WebDriver :: Proxy를 만들려고 했습니까?

또한

profile.proxy = @@proxy.selenium_proxy :http, :ssl 

는 BrowsermobProxy 자체는 보통 9090에서 실행, 그래서 당신은 당신이 위의 코드를 사용하는 경우 포트를 지정할 필요가 없습니다 9090에 프록시를 만들려고 할 때 나는 포트 충돌을 예상했을 것이다 .

@@proxy = server.create_proxy