Naoya Makino
Naoya Makino

Reputation: 557

How to change Base URL in Selenium

I have been testing a twitter web-based application using Selenium RC in Ruby. What I want to accomplish is: Click "Connect with Twitter", pops up the twitter oauth page, type username and password, and click Allow button.

However, when it connects with twitter, it directs to twitter oauth page which is different URL from the base URL.

Is there any way that I can change the base URL so that I can do stuff on different urls? Also, since each twitter oauth page has a different oauth_token in the end of URL, how should I set a URL such that it can handle urls with different oauth_token in the end?

Thank you for your suggestions!

regards

Naoya

Upvotes: 1

Views: 1219

Answers (1)

speckledcarp
speckledcarp

Reputation: 6375

What's the symptom you're seeing? Is Selenium throwing Permission Denied errors? If so, you could probably fix it by using a browser launcher with heightened security privileges. If you're using *iexplore, try using the *iehta, if using firefox, try *chrome instead of *firefox.

For example:

@browser = Selenium::Client::Driver.new \
      :host => "localhost",
      :port => 4444,
      :browser => "*iehta",
      :url => "http://www.google.com",
      :timeout_in_second => 60

These allow you to circumvent the "Same Origin" security restrictions. This way it won't matter if they have the same base URL.

Upvotes: 1

Related Questions