如何Python打开浏览器打开指定网页(三)

2026-04-01 14:34:02

1、首先,点击右键新建一个文本文档。

如何Python打开浏览器打开指定网页(三)

2、然后,将文档的后缀txt改为py。

如何Python打开浏览器打开指定网页(三)

3、然后,右键使用edit with idle打开。

如何Python打开浏览器打开指定网页(三)

4、然后输入代码:

from selenium import webdriver

driver = webdriver.Chrome()

driver.get('这里输入指定网址')

如何Python打开浏览器打开指定网页(三)

5、然后,点击菜单栏中的RUN——run modle。

如何Python打开浏览器打开指定网页(三)

6、最后,等待程序运行约3秒,指定网页就打开了。

如何Python打开浏览器打开指定网页(三)

猜你喜欢