Browsermob Proxy + Selenium + Ruby setup giving 550 response





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















So I am looking at trying to integrate Browsermob into a Ruby project so i can edit http responses.
I have been following the setup with Selenium instructions from the Github and another article I found about performance testing - which I also want to do.



For this, I have gone with the code from the performance testing article but the results I am getting are the same.
The code is



require 'selenium-webdriver'
require 'browsermob/proxy'
require 'rspec-expectations'
include RSpec::Matchers
require 'json'

def configure_proxy
proxy_binary = BrowserMob::Proxy::Server.new('my/path/to/browsermob-proxy-2.1.4/bin/browsermob-proxy')
proxy_binary.start
proxy_binary.create_proxy
end

def browser_profile
browser_profile = Selenium::WebDriver::Firefox::Profile.new
browser_profile.proxy = @proxy.selenium_proxy
browser_profile
end

def setup
@proxy = configure_proxy
@driver = Selenium::WebDriver.for :firefox, profile: browser_profile
end

def teardown
@driver.quit
@proxy.close
end

def capture_traffic
@proxy.new_har
yield
@proxy.har
end

def run
setup
har = capture_traffic { yield }
@har_file = "./selenium_#{Time.now.strftime("%m%d%y_%H%M%S")}.har"
har.save_to @har_file
teardown
end

run do
@driver.get 'http://the-internet.herokuapp.com/dynamic_loading/2'
@driver.find_element(css: '#start button').click
Selenium::WebDriver::Wait.new(timeout: 8).until do
@driver.find_element(css: '#finish')
end
end

performance_results = JSON.parse `yslow --info basic --format json #{@har_file}`
performance_grade = performance_results["o"]
performance_grade.should be > 90


Now, the problem I get is that as soon as I try to run this code (isolated away from my project or even within it) I get:



(.rvm/gems/ruby-2.5.3/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:220:in 'rescue in exception_with_response': HTTP status code 550 (RestClient::RequestFailed)



Does anyone know why I would be getting this? I understand that a 550 is an action not taken code but I'm confused as to why I would be getting this?



Any help would be VERY much appreciated!










share|improve this question


















  • 1





    Can't say much about the error reason, but what I see is that the gem last version released in 2014. A lot of things changed in ruby and rails since. If you're trying to run the thing with latest rails — no surprise it doesn't work.

    – Alexey Suslyakov
    Jan 4 at 13:52


















1















So I am looking at trying to integrate Browsermob into a Ruby project so i can edit http responses.
I have been following the setup with Selenium instructions from the Github and another article I found about performance testing - which I also want to do.



For this, I have gone with the code from the performance testing article but the results I am getting are the same.
The code is



require 'selenium-webdriver'
require 'browsermob/proxy'
require 'rspec-expectations'
include RSpec::Matchers
require 'json'

def configure_proxy
proxy_binary = BrowserMob::Proxy::Server.new('my/path/to/browsermob-proxy-2.1.4/bin/browsermob-proxy')
proxy_binary.start
proxy_binary.create_proxy
end

def browser_profile
browser_profile = Selenium::WebDriver::Firefox::Profile.new
browser_profile.proxy = @proxy.selenium_proxy
browser_profile
end

def setup
@proxy = configure_proxy
@driver = Selenium::WebDriver.for :firefox, profile: browser_profile
end

def teardown
@driver.quit
@proxy.close
end

def capture_traffic
@proxy.new_har
yield
@proxy.har
end

def run
setup
har = capture_traffic { yield }
@har_file = "./selenium_#{Time.now.strftime("%m%d%y_%H%M%S")}.har"
har.save_to @har_file
teardown
end

run do
@driver.get 'http://the-internet.herokuapp.com/dynamic_loading/2'
@driver.find_element(css: '#start button').click
Selenium::WebDriver::Wait.new(timeout: 8).until do
@driver.find_element(css: '#finish')
end
end

performance_results = JSON.parse `yslow --info basic --format json #{@har_file}`
performance_grade = performance_results["o"]
performance_grade.should be > 90


Now, the problem I get is that as soon as I try to run this code (isolated away from my project or even within it) I get:



(.rvm/gems/ruby-2.5.3/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:220:in 'rescue in exception_with_response': HTTP status code 550 (RestClient::RequestFailed)



Does anyone know why I would be getting this? I understand that a 550 is an action not taken code but I'm confused as to why I would be getting this?



Any help would be VERY much appreciated!










share|improve this question


















  • 1





    Can't say much about the error reason, but what I see is that the gem last version released in 2014. A lot of things changed in ruby and rails since. If you're trying to run the thing with latest rails — no surprise it doesn't work.

    – Alexey Suslyakov
    Jan 4 at 13:52














1












1








1








So I am looking at trying to integrate Browsermob into a Ruby project so i can edit http responses.
I have been following the setup with Selenium instructions from the Github and another article I found about performance testing - which I also want to do.



For this, I have gone with the code from the performance testing article but the results I am getting are the same.
The code is



require 'selenium-webdriver'
require 'browsermob/proxy'
require 'rspec-expectations'
include RSpec::Matchers
require 'json'

def configure_proxy
proxy_binary = BrowserMob::Proxy::Server.new('my/path/to/browsermob-proxy-2.1.4/bin/browsermob-proxy')
proxy_binary.start
proxy_binary.create_proxy
end

def browser_profile
browser_profile = Selenium::WebDriver::Firefox::Profile.new
browser_profile.proxy = @proxy.selenium_proxy
browser_profile
end

def setup
@proxy = configure_proxy
@driver = Selenium::WebDriver.for :firefox, profile: browser_profile
end

def teardown
@driver.quit
@proxy.close
end

def capture_traffic
@proxy.new_har
yield
@proxy.har
end

def run
setup
har = capture_traffic { yield }
@har_file = "./selenium_#{Time.now.strftime("%m%d%y_%H%M%S")}.har"
har.save_to @har_file
teardown
end

run do
@driver.get 'http://the-internet.herokuapp.com/dynamic_loading/2'
@driver.find_element(css: '#start button').click
Selenium::WebDriver::Wait.new(timeout: 8).until do
@driver.find_element(css: '#finish')
end
end

performance_results = JSON.parse `yslow --info basic --format json #{@har_file}`
performance_grade = performance_results["o"]
performance_grade.should be > 90


Now, the problem I get is that as soon as I try to run this code (isolated away from my project or even within it) I get:



(.rvm/gems/ruby-2.5.3/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:220:in 'rescue in exception_with_response': HTTP status code 550 (RestClient::RequestFailed)



Does anyone know why I would be getting this? I understand that a 550 is an action not taken code but I'm confused as to why I would be getting this?



Any help would be VERY much appreciated!










share|improve this question














So I am looking at trying to integrate Browsermob into a Ruby project so i can edit http responses.
I have been following the setup with Selenium instructions from the Github and another article I found about performance testing - which I also want to do.



For this, I have gone with the code from the performance testing article but the results I am getting are the same.
The code is



require 'selenium-webdriver'
require 'browsermob/proxy'
require 'rspec-expectations'
include RSpec::Matchers
require 'json'

def configure_proxy
proxy_binary = BrowserMob::Proxy::Server.new('my/path/to/browsermob-proxy-2.1.4/bin/browsermob-proxy')
proxy_binary.start
proxy_binary.create_proxy
end

def browser_profile
browser_profile = Selenium::WebDriver::Firefox::Profile.new
browser_profile.proxy = @proxy.selenium_proxy
browser_profile
end

def setup
@proxy = configure_proxy
@driver = Selenium::WebDriver.for :firefox, profile: browser_profile
end

def teardown
@driver.quit
@proxy.close
end

def capture_traffic
@proxy.new_har
yield
@proxy.har
end

def run
setup
har = capture_traffic { yield }
@har_file = "./selenium_#{Time.now.strftime("%m%d%y_%H%M%S")}.har"
har.save_to @har_file
teardown
end

run do
@driver.get 'http://the-internet.herokuapp.com/dynamic_loading/2'
@driver.find_element(css: '#start button').click
Selenium::WebDriver::Wait.new(timeout: 8).until do
@driver.find_element(css: '#finish')
end
end

performance_results = JSON.parse `yslow --info basic --format json #{@har_file}`
performance_grade = performance_results["o"]
performance_grade.should be > 90


Now, the problem I get is that as soon as I try to run this code (isolated away from my project or even within it) I get:



(.rvm/gems/ruby-2.5.3/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:220:in 'rescue in exception_with_response': HTTP status code 550 (RestClient::RequestFailed)



Does anyone know why I would be getting this? I understand that a 550 is an action not taken code but I'm confused as to why I would be getting this?



Any help would be VERY much appreciated!







ruby-on-rails ruby selenium browsermob-proxy






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 4 at 13:27









Ian Pie GoddardIan Pie Goddard

142




142








  • 1





    Can't say much about the error reason, but what I see is that the gem last version released in 2014. A lot of things changed in ruby and rails since. If you're trying to run the thing with latest rails — no surprise it doesn't work.

    – Alexey Suslyakov
    Jan 4 at 13:52














  • 1





    Can't say much about the error reason, but what I see is that the gem last version released in 2014. A lot of things changed in ruby and rails since. If you're trying to run the thing with latest rails — no surprise it doesn't work.

    – Alexey Suslyakov
    Jan 4 at 13:52








1




1





Can't say much about the error reason, but what I see is that the gem last version released in 2014. A lot of things changed in ruby and rails since. If you're trying to run the thing with latest rails — no surprise it doesn't work.

– Alexey Suslyakov
Jan 4 at 13:52





Can't say much about the error reason, but what I see is that the gem last version released in 2014. A lot of things changed in ruby and rails since. If you're trying to run the thing with latest rails — no surprise it doesn't work.

– Alexey Suslyakov
Jan 4 at 13:52












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54039859%2fbrowsermob-proxy-selenium-ruby-setup-giving-550-response%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54039859%2fbrowsermob-proxy-selenium-ruby-setup-giving-550-response%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas