Skip to content

Commit

Permalink
动态访问数据会自动打开浏览器
Browse files Browse the repository at this point in the history
  • Loading branch information
JLUVicent committed Sep 15, 2021
1 parent 631ccf4 commit 24aaafe
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 24_selenium_selenium基本使用.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

# (1)导入selenium
from selenium import webdriver

# (2)创建浏览器操作对象
path = 'chromedriver.exe'

browser = webdriver.Chrome(path)

# (3)访问网站
# url='https://www.baidu.com'

# browser.get(url)

url = 'https://www.jd.com/'
browser.get(url)

# page_source获取网页源码
content = browser.page_source

print(content)

0 comments on commit 24aaafe

Please sign in to comment.