0

我正在使用 browserstack 进行测试,但无法让 browserstack 识别驱动程序。当我在本地运行它时,该测试可以正常工作并通过,并且 browserstack 提供的示例测试也可以通过,没有错误。

这是我的错误:

test/silver_auction_application.rb:68:in `test_silver_auction_application'
     65:   
     66:   def test_silver_auction_application
     67:     # @driver.get(@base_url + "/")
  => 68:     @driver.find_element(:id, "login").click
     69:     @driver.find_element(:link, "Sign Up Now!").click
     70:     @driver.find_element(:link, "Select Silver").click
     71:     @driver.find_element(:id, "user_email").clear

这是代码:

require "json"
require "selenium-webdriver"
gem "test-unit"
require 'rubygems'



class SilverAuctionApplication < Test::Unit::TestCase
    # Input capabilities
    def setup
        caps = Selenium::WebDriver::Remote::Capabilities.new
        caps["browser"] = "IE"
        caps["browser_version"] = "7.0"
        caps["os"] = "Windows"
        caps["os_version"] = "XP"
        caps["browserstack.debug"] = "true"
        caps["name"] = "Testing Selenium 2 with Ruby on BrowserStack"

        @driver = Selenium::WebDriver.for(:remote,
          :url => "my url",
          :desired_capabilities => caps)
        @driver.navigate.to "http://localhost:3000/"
        puts @driver.title
    end

    def teardown
        @driver.quit
    end




def test_silver_auction_application
    @driver.get(@base_url + "/")
    @driver.find_element(:id, "login").click
    @driver.find_element(:link, "Sign Up Now!").click
    @driver.find_element(:link, "Select Silver").click
    @driver.find_element(:id, "user_email").clear
    @driver.find_element(:id, "user_email").send_keys "mercarisseller@gmail.com"
    @driver.find_element(:id, "user_first_name").clear
    @driver.find_element(:id, "user_first_name").send_keys "Seller"
    @driver.find_element(:id, "user_last_name").clear
    @driver.find_element(:id, "user_last_name").send_keys "Mercaris"
    @driver.find_element(:id, "user_password").clear
    @driver.find_element(:id, "user_password").send_keys "Organic123"
    @driver.find_element(:id, "user_password_confirmation").clear
    @driver.find_element(:id, "user_password_confirmation").send_keys "Organic123"
    @driver.find_element(:id, "organization_name").clear
    @driver.find_element(:id, "organization_name").send_keys "Seller's Org."
    @driver.find_element(:name, "newsletter").click
    @driver.find_element(:id, "required").click
    @driver.find_element(:name, "commit").click
    @driver.find_element(:id, "populate").click
    @driver.find_element(:id, "cc-submit").click
    @driver.find_element(:link, "<< Back to Account").click
    @driver.find_element(:link, "Click here to connect your bank account.").click
    @driver.find_element(:id, "populate").click
    @driver.find_element(:id, "ba-submit").click
    @driver.find_element(:link, "Back To Dashboard").click
   end
end
4

1 回答 1

2

This is Umang replying on behalf of BrowserStack.

If "my url" points to BrowserStack's Selenium Hub http://USERNAME:ACCESS_KEY@hub.browserstack.com/wd/hub , then your test should execute on BrowserStack.

Also, I see the URL, you are testing is "http://localhost:3000/". If you wish access your local servers on BrowserStack, you need to use BrowserStack's Local Testing feature. You can follow these steps:

a) Set up the Local Testing connection using the binaries, by executing the following command:

Browserstacklocal.exe <automate-key>

b) Add the capability 'browserstack.local' = 'true' in your test scripts.

If you are still facing issues, we would suggest you drop in a mail to support@browserstack.com. We will be happy to help you out.

于 2015-04-24T15:05:57.173 回答