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.
Try this:
url = URI.parse(current_url)
from capybara session doc:
Fully qualified URL of the current page
def current_url driver.current_url end
Path of the current page, without any domain information
def current_path URI.parse(current_url).path end
I think that what you are doing is not right
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With