Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 具有PhantomJS的Watir Webdriver能否访问具有基本身份验证的外部URL?_Ruby_Phantomjs_Watir Webdriver - Fatal编程技术网

Ruby 具有PhantomJS的Watir Webdriver能否访问具有基本身份验证的外部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

我正在使用watir webdriver和cucumber和ruby为网站建立自动回归测试。Cucumber和watir webdriver不属于用于实际站点的rails应用程序。为了让我的测试在Jenkins上运行,我想开始使用phantomjs来无头运行测试。为了访问网站的预生产环境,我需要通过网站的基本身份验证

我遇到的问题是:当phantomjs试图访问具有基本身份验证的外部URL时,它被挂起,无法通过基本身份验证用户名/密码

关于如何让phantomjs识别如下URL的任何想法:

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...}