没有合适的资源?快使用搜索试试~ 我知道了~
小伙伴们,这次推文讲的是‘xpath‘,掌握起来不难的哦。而且,熟悉了这套路,别说pubmed,任何你能在浏览器实现的操作,都基本能通过selenium自动化进行。 总代码: for i in range(51,56): driver.implicitly_wait(10) ActionChains(driver).move_to_element(driver.find_element_by_xpath('//*[@id="save-results-panel-trigger"]')).click().perform() Select(driver.find_element_by
资源推荐
资源详情
资源评论
Python自动化自动化xpath实现自动抢票抢货实现自动抢票抢货
小伙伴们,这次推文讲的是‘xpath‘,掌握起来不难的哦。而且,熟悉了这套路,别说pubmed,任何你能在浏览器实现的操
作,都基本能通过selenium自动化进行。
总代码:
for i in range(51,56):
driver.implicitly_wait(10)
ActionChains(driver).move_to_element(driver.find_element_by_xpath('//*[@id="save-results-panel-trigger"]')).click().perform()
Select(driver.find_element_by_xpath('//*[@id="save-action-selection"]')).select_by_visible_text("All results on this page")
ActionChains(driver).move_to_element(driver.find_element_by_xpath('//*[@id="save-action-format"]')).click().perform()
Select(driver.find_element_by_xpath('/html/body/main/div[1]/div/form/div[2]/select')).select_by_visible_text("CSV")
ActionChains(driver).move_to_element(driver.find_element_by_xpath('//*[@id="save-action-panel-
form"]/div[3]/button[1]')).click().perform()
target =driver.find_element_by_xpath('//*[@id="search-results"]/section/div[3]/a/span')
driver.execute_script("arguments[0].();", target)
ActionChains(driver).move_to_element(driver.find_element_by_xpath('//*[@id="search-
results"]/section/div[3]/a/span')).click().perform()
ActionChains(driver).move_to_element(driver.find_element_by_xpath('//*[@id="search-
page"]/div[12]/div/form/button')).click().perform()
print('第'+str(i)+'页下载成功')
print('跳转第'+str(i+1)+'页面中')
driver.quit()
print('全部下载完毕,自动退出。')
代码1
for i in range(1,50+1): printg(‘我错了’)
资源评论
weixin_38702339
- 粉丝: 2
- 资源: 914
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功