from selenium import webdriver path = 'phantomjs.exe' # phantomjs路径 browser = webdriver.PhantomJS(path) url = 'https://www.baidu.com' browser.get(url) browser.save_screenshot('baidu.png') #截图 import time time.sleep(2) input = browser.find_element_by_id('kw') input.send_keys('昆凌') time.sleep(3) browser.save_screenshot('kunling.png') #截图 #截图保存在但前目录
selenium的用法大全
python—selenium交互