I have a program where I'm using Python's webbrowser
module to open a browser and navigate to a page automatically. My code essentially looks like the following:
import webbrowser
chrome_path = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s"
url = "stackoverflow.com"
webbrowser.get(chrome_path).open(url)
When doing it with a normal site it works exactly as expected. However, when I instead substitute in an internal Chrome site of the format chrome://<page>
(e.g. chrome://dino
or chrome://version
) for the url, Chrome opens as expected, but it does not navigate anywhere but rather instead stays on my new tab page.
Why are normal urls (and even strings such as "hello world") working as expected, but only chrome-specific pages not? Is there any way to get around this?
(This is on Windows 10 & Python 3.6.8 by the way).
webbrowser
, but I can confirm thatChrome('chromedriver.exe').get('chrome://dino')
works in selenium. You might want to give that a try – DeepSpacewebbrowser
since it's a bit simpler and (I believe) already comes with Python. – MLavrentyevwebbrowser.get('chrome').open("stackoverflow.com")
I now instead get it returning False and not opening Chrome at all. – MLavrentyevchrome://
paths is prohibited. Likely to prevent malicious interaction with browser settings. – JamesJJ