标签:请求 driver text ext table pytho python学习 arch sele
from selenium import webdriver
from lxml import etree
import time
a = webdriver.Chrome(executable_path=r‘D:\python学习\其他\chromedriver.exe‘)
url = ‘https://jd.com‘
a.get(url) # 用户发起请求
search_input = a.find_element_by_id(‘key‘) # 定位到input框
search_input.send_keys(‘电脑‘) # 输入内容
btn = a.find_element_by_xpath(‘//*[@id="search"]/div/div[2]/button‘) # 定位到按钮
btn.click() # 点击按钮
page_text = a.page_source # 下载网页源码
a.quit()
标签:请求 driver text ext table pytho python学习 arch sele
原文地址:https://www.cnblogs.com/zjj999/p/12612326.html