Ruby 具有PhantomJS的Watir Webdriver能否访问具有基本身份验证的外部URL?
我正在使用watir webdriver和cucumber和ruby为网站建立自动回归测试。Cucumber和watir webdriver不属于用于实际站点的rails应用程序。为了让我的测试在Jenkins上运行,我想开始使用phantomjs来无头运行测试。为了访问网站的预生产环境,我需要通过网站的基本身份验证 我遇到的问题是:当phantomjs试图访问具有基本身份验证的外部URL时,它被挂起,无法通过基本身份验证用户名/密码 关于如何让phantomjs识别如下URL的任何想法:Ruby 具有PhantomJS的Watir Webdriver能否访问具有基本身份验证的外部URL?,ruby,phantomjs,watir-webdriver,Ruby,Phantomjs,Watir Webdriver,我正在使用watir webdriver和cucumber和ruby为网站建立自动回归测试。Cucumber和watir webdriver不属于用于实际站点的rails应用程序。为了让我的测试在Jenkins上运行,我想开始使用phantomjs来无头运行测试。为了访问网站的预生产环境,我需要通过网站的基本身份验证 我遇到的问题是:当phantomjs试图访问具有基本身份验证的外部URL时,它被挂起,无法通过基本身份验证用户名/密码 关于如何让phantomjs识别如下URL的任何想法: ht
https://admin:password@test.website.com"
env.rb:
BASE_URL = Configuration["base_url"]
require "watir-webdriver"
case ENV['BROWSER']
when 'chrome'
profile = Selenium::WebDriver::Chrome::Profile.new
browser = Watir::Browser.new :chrome, :profile => profile
when 'firefox'
profile = Selenium::WebDriver::Firefox::Profile.new
browser = Watir::Browser.new :firefox, :profile => profile
when 'phantomjs'
browser = Watir::Browser.new :phantomjs
end
end
cucumber -p website BROWSER=phantomjs
Scenario: User Logs In
Given a logged out user
timed out after 30 seconds, waiting for {foobar...}
config.yml
website:
base_url: "https://admin:password@test.website.com"
跑步黄瓜:
BASE_URL = Configuration["base_url"]
require "watir-webdriver"
case ENV['BROWSER']
when 'chrome'
profile = Selenium::WebDriver::Chrome::Profile.new
browser = Watir::Browser.new :chrome, :profile => profile
when 'firefox'
profile = Selenium::WebDriver::Firefox::Profile.new
browser = Watir::Browser.new :firefox, :profile => profile
when 'phantomjs'
browser = Watir::Browser.new :phantomjs
end
end
cucumber -p website BROWSER=phantomjs
Scenario: User Logs In
Given a logged out user
timed out after 30 seconds, waiting for {foobar...}
结果:
BASE_URL = Configuration["base_url"]
require "watir-webdriver"
case ENV['BROWSER']
when 'chrome'
profile = Selenium::WebDriver::Chrome::Profile.new
browser = Watir::Browser.new :chrome, :profile => profile
when 'firefox'
profile = Selenium::WebDriver::Firefox::Profile.new
browser = Watir::Browser.new :firefox, :profile => profile
when 'phantomjs'
browser = Watir::Browser.new :phantomjs
end
end
cucumber -p website BROWSER=phantomjs
Scenario: User Logs In
Given a logged out user
timed out after 30 seconds, waiting for {foobar...}