简体   繁体   中英

How can i execute my webbrowser in Python?

I need to execute my webbrowser (opera) from python code, how can i get it?

Python version 3.6, OS MS Windows 7

Use webbrowser module in python.

import webbrowser as wb
wb.get('chrome %s').open_new_tab('http://www.google.com')

You can open your default web browser in python this way by writing this command in cmd :

python -mwebbrowser -n URL

-n : new window

Look at thewebbrowser documentation to see other options as well.

您可以使用 Selenium 通过 python 启动 Web 浏览器。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM