Selenium automation interview preperation question
irl last edited by
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 don't know, but I could try and see what happens. Why do you ask? Did you have problems with this in the past?
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.