How to get current path with query string using capybara?

Member

by adan , in category: Third Party Scripts , a year ago

How to get current path with query string using capybara?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by haylee.mertz , a year ago

@adan 

To get the current path with query string using Capybara, you can use the current_url method.


Here's an example:

1
current_url = page.current_url


This will return the current URL of the page, including the query string if it exists. You can then capture this URL and use it as needed in your tests.