I have a little pythons script that launches all tabs on startup that I need, in the end there should be a new tab page:
import requests
import subprocess
import time
chrome_path = r'C:\Program Files\Google\Chrome\Application\chrome.exe'
if is_this:
subprocess.Popen([chrome_path, 'example.com'])
time.sleep(5)
subprocess.Popen([chrome_path, 'https://exmaple.com'])
time.sleep(0.2)
subprocess.Popen([chrome_path, 'http://guthib.com'])
time.sleep(0.2)
subprocess.Popen([chrome_path, 'chrome://newtab'])
else:
subprocess.Popen([chrome_path, 'https://github.com'])
time.sleep(0.2)
subprocess.Popen([chrome_path, 'http://testurl.com'])
time.sleep(0.2)
subprocess.Popen([chrome_path, 'chrome://newtab'])
That all works fine, except the chrome://newtab opens a new chrome window instead of a new-tab-page in the same window.
I literally searched all over the web and could not find a solution, except that using selenium with webdriver, however with them I get soo many problems:
It's not launching with my chrome profile It shouws a banner that this browser is running aautomated Windows Defender flaggs it. newtab als does not work there.
Thanks for any help.
Would you consider using the Browserist extension to Selenium?
In full disclosure, I'm the author of this package. Browserist is lightweight, less verbose extension of the Selenium web driver that makes browser automation even easier. Simply install the package with
pip install browserist
and you're ready to go.Maybe something like this could solve your problem?
How it looks like:
Notes:
Y
.