Reputation: 165
I am using browserstack for my testing, and I can't get browserstack to recognize the driver. The test works and passes with flying colors when I run it locally, and the example test that browserstack provides also passes without error.
Here is my error:
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
Here is the code:
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 "[email protected]"
@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
Upvotes: 0
Views: 466
Reputation: 762
This is Umang replying on behalf of BrowserStack.
If "my url" points to BrowserStack's Selenium Hub http://USERNAME:[email protected]/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 [email protected]. We will be happy to help you out.
Upvotes: 2