-1

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.

Bohdan Kaminskyi
  • 134
  • 1
  • 11
  • Does the link I shared with you in my reply help you to understand the cause of the issue? If yes, you can try to accept the answer. It can help other community members in the future in similar kinds of issues. Thanks for your understanding. [See here](https://stackoverflow.com/help/someone-answers) – Deepak-MSFT Sep 30 '20 at 07:08

3 Answers3

0

The main concern is, your program shouldn't be stuck with data:, in the url bar. Incase this situation happens the simplest solution would be to crosscheck the following points:

  • When invoking get() method passing an URL you need to pass the Fully Qualified Domain Name (FQDN). You need to ensure the url is properly formatted. As an example, the protocol i.e. http is appended along with the actual url as follows:

    https://www.google.com/
    
  • Additionally, you also need to ensure that you are using compatibile version of binaries in terms of Google Chrome Browser and ChromeDriver

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
0

I agree with the suggestion given by the @DebanjanB.

When using driver.get("URL") method you need to compulsory pass the protocol with the URL.

If you do not pass the protocol then you will get an error.

The error might be a little bit different based on the programming language you are using.

I suggest you refer to this document and try to fully read it. It is for Firefox and using the JAVA language but the logic remains the same for all the browsers and all the programming languages. I hope it will help you to clear your confusion.

Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19
0

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

Bohdan Kaminskyi
  • 134
  • 1
  • 11