What error does this line return when I pass a URL without HTTPS or HTTP
It was asked to a fresher in his interview.
I think it is a stupid question to ask in an interview, because it asks a very specific detail of how to use WebDriver that I have not really thought about in the 10 years I am using Selenium, but this might a great answer:
I have just tried removing HTTPS with WebDriver C#, but it uses
driver.Navigate().GoToUrl(), it gives:
Message: OpenQA.Selenium.WebDriverException : invalid argument
(Session info: chrome=77.0.3865.120)
I think it might be different depending on language and or browser driver implementation.
There might be a risk that leaving out the HTTPS it could default to HTTP, thus not testing the HTTPS version of the site. I do think HTTP should always redirect to HTTPS and you should only test one version.
If you try to open a URL without http or https (for e.g.
get() method will throw an error
It will also gives error message as
“Cannot navigate to invalid URL”.