Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8107859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:54:43+00:00 2026-06-06T00:54:43+00:00

I maintain a test suite utilizing Selenium and Capybara. While I can convince Selenium

  • 0

I maintain a test suite utilizing Selenium and Capybara. While I can convince Selenium to access pages outside of my home domain, it appears that Capybara cannot track the URL in the browser’s address bar. I tracked this deficiency down to behavior in Selenium::WebDriver, which is Ruby’s binding to Selenium 2.

Googling around, it looks like Selenium has what appears to be a mode you can set it in, which enables cross-domain operation. However, I find no reference to anything specific.

Some folks on StackOverflow talk about using either Chrome or Firefox with “elevated privileges,” but again, I’m just not finding any information on using such features. Inevitably, these questions end up unanswered.

Still other popular SO suggestsions talk about using the “open” command to explicitly bring the browser to a new site. This isn’t acceptable for the obvious reason that users don’t type domain names as a general rule. For example, if I visit, say, youtube.com, and find a video I like with a Twitter icon under the description, then clicking on that Twitter button should direct me to an appropriate twitter.com address. The user does not have to type the twitter address manually. Making use of selenium’s open command breaks the test, because the test no longer reflects user behavior (it emulates someone actually typing an address in the bar), and thus breaks the intent of the test, which is to confirm whether or not the twitter button actually works as intended.

I’m beginning to believe that true, automated cross-domain operation is simply impossible.

So, basically, I have two questions:

(1) Given a test script which opens Selenium on, say, “www.example.com”, and I ask Selenium to click on a link which directs the browser elsewhere, is it =possible= to somehow capture the URL the browser’s address bar reads after the click succeeds? And (2) Knowing that it is possible, =how= do I do it? I’m simply not finding any information on this. If I read @session.driver.browser.current_url, it would still report a URL on example.com, not the browser’s current URL.

I’m not quite sure how to provide sample source code to help illustrate what I want in a way that wouldn’t confuse the matter with irrelevant detail, but if folks want sample source code, please let me know, and I’ll try to whip something up.

Thank you for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:54:45+00:00Added an answer on June 6, 2026 at 12:54 am

    Use

    selenium.click("some redirect link");
    selenium.waitforpagetoload("30000"); //page load time
    string url=selenium.getlocation(); //storing the url in a string.
    

    If this is not Helpful,please post a sample code or a link to webpage where you are doing this test.

    I don’t know how to do it in Ruby. But i will post the HTML code for this test. So you paste this code in your Selenium IDE and export it as Ruby or any language you prefer.

    HTML code

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head profile="http://selenium-ide.openqa.org/profiles/test-case">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="selenium.base" href="http://www.google.co.in/" />
    <title>New Test</title>
    </head>
    <body>
    <table cellpadding="1" cellspacing="1" border="1">
    <thead>
    <tr><td rowspan="1" colspan="3">New Test</td></tr>
    </thead><tbody>
    <tr>
    <td>open</td>
    <td>youtube</td>
    <td></td>
    </tr>
    <tr>
    <td>clickAndWait</td>
    <td>id=redirect_link</td>
    <td></td>
    </tr>
    <tr>
    <td>verifyLocation</td>
    <td>resultant_page_URL</td>
    <td></td>
    </tr>
    </tbody></table>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a testing suite based on Selenium 2. The goal is to test
How can you maintain the links in your pdf fileA which contains links to
I have a suite of webpart controls that I maintain and develop for our
Item 2 of the Joel Test is Can you make a build in one
I'm using the latest version of Selenium and the chromedriver to test a ZK
I am trying to test my controller and maintain separation of concerns. The first
Background I have written a test suite in mstest which has a template XML.
We maintain a library used by test scripts which do system level testing. Part
When implementing algorithms and other things while trying to maintain reusability and separation patterns,
I am using signed cookies to maintain my user across pages, pretty much implemented

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.