Retrieving Current URL Using 'getUrl' Method in WebDriverIO
The WebDriverIO API provides the 'getUrl' method that returns the current URL of the webpage. Here's an example where we navigate to the Wikipedia Main Page and then retrieve the URL:
const currentUrl = await browser.getUrl();
Here is an example test that uses the above code snippet.
This code fetches the current URL using the 'getUrl' method. Remember, 'getUrl' is an asynchronous operation and should be awaited for its completion.