Search code examples
python-3.xseleniumselenium-webdrivermicrosoft-edgeselenium-edgedriver

Selenium InvalidArgumentException on opening webpage without protocol specified (http/https)


On Windows 10 (64bit, python3.6.8), I'm unable to open link via driver's get method in case link was filled without http:// or https:// protocol specified.

I use selenium==3.141 and msedge-selenium-tools-3.141.2 with python. Microsoft Edge version 85.0.564.51 (same as driver version).

The following code raises error:

from msedge.selenium_tools import Edge, EdgeOptions

options = EdgeOptions()
options.set_capability('platform', 'Windows')
options.use_chromium = True


path = r'<correct path to driver>'

driver = Edge(executable_path=path,
                    service_args=None,
                    options=options,
                    desired_capabilities={})
driver.get('google.com')

Error: selenium.common.exceptions.InvalidArgumentException: Message: invalid argument (Session info: MicrosoftEdge=85.0.564.51)

Browser state on error - browser is launched and points to data:, url.

After some investigation, I found that in case I change driver.get('google.com') to driver.get('http://google.com'), issue is not reproducible.


Solution

  • After I tried to run the same code on another machine, it worked pretty well without any errors. For me it looks like some issues with setup or Parallels VM I used on first machine