So im trying to run some automation testing on a Rails site that requires what seems to be a basic HTTP Authentication:
Im using localhost:3000 as my host.
Capybara.app_host = "http://localhost:3000"
Capybara.server_host = "localhost"
Capybara.server_port = "3000"
Im running this on firefox right now, and I tried doing http://username:password@localhost:3000 but it usually warns about "phishing sites" but I proceed anyways, but it doesn't work and the http popup still appears. (I've heard a lot of browsers disabled this ability).
I know Selenium has ways to get around it, but what about Poltergeist? or anything built into Capybara.
I saw a previous question mentioned here: HTTP basic auth for Capybara
but seeing as how the above url doesn't work this didn't seem to work either.
edit: Current Poltergeist driver setup:
options = {
:timeout => 45,
:phantomjs_options => ["--proxy-auth="]
}
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, options)
end
Capybara.default_driver = :selenium
Capybara.javascript_driver = :poltergeist
You can try
page.driver.basic_authorize(username, password)
before visiting the page in Poltergeist. That will set the username and password in phantomjs and also the 'Authorization' header