Skip to content

Commit

Permalink
Phantomjs是隐形浏览器目前已经停更,不用他了
Browse files Browse the repository at this point in the history
  • Loading branch information
JLUVicent committed Sep 15, 2021
1 parent 1d144bf commit 07b9c5f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions 28_selenium_phantomjs的基本使用.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

import time
from selenium import webdriver

path = 'phantomjs.exe'

browser = webdriver.PhantomJS(path)

url = 'https://www.baidu.com'

browser.get(url)

# 拍快照
browser.save_screenshot('baidu.png')

time.sleep(2)

input = browser.find_element_by_id('kw')
input.send_keys('Vicent')
time.sleep(2)
browser.save_screenshot('Vicent.png')

0 comments on commit 07b9c5f

Please sign in to comment.