netcoder netcoder - 1 year ago 265
Ruby Question

How to get the full URL with the current path in Capybara

I'm new to writing tests in capybara and I'm having trouble getting the current URL of a page. I wrote it like this:

url = page.current_url + page.current_path

Somehow its just returning the base URL. Help is much appreciated.

Answer Source

Try this:

url = URI.parse(current_url)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download