webdriverio: browser.url(url) not working remotely (browserstack)

[//]: # NOTE: This repository only maintains packages that are listed in the Readme. Please make sure that your issue is directly caused by one of these packages and if not file an issue in the correct 3rd party package repository.

Environment (please complete the following information):

  • WebdriverIO version: 7.0.5
  • Mode: Standalone mode
  • Node.js version: 12.18.4
  • Yarn version: 1.22.10
  • Browser name and version: Chrome 88
  • Platform name and version: Mac 10.15.7 (Catalina)

Describe the bug When using browser.url(url); I am getting this error message when running remotely via Browserstack

   "TypeError [ERR_INVALID_URL]: Invalid URL:
     at onParseError (internal/url.js:256:9)
     at new URL (internal/url.js:332:5)
     at new URL (internal/url.js:329:22)
    at Browser.url (/xxxxx/node_modules/webdriverio/build/commands/browser/url.js:43:17)"

locally its working as expected.

To Reproduce

// navigate to a new URL (local and browserstack)
browser.url('https://webdriver.io');
// receive url
console.log(browser.getUrl()); // outputs: "https://webdriver.io"

Expected behavior The given url should be received both locally and remotely.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

@larryg01 the problem was that the base url was an empty string. I created a PR with a fix that ensures that empty strings are ignored.

@larryg01 I looked into the issue again and the implementation seems fine to me. I have no idea why it is working locally but failing on BS. The WebDriver commands send to the driver are the same. I am happy to re-open the issue if you can provide a minimal reproducible example. Thanks for your effort looking into this.