#!/usr/bin/python # -*- coding: utf-8 -*- from selenium import webdriver import time # browser = webdriver.Firefox() # browser = webdriver.Ie() browser = webdriver.Chrome() browser.get("") browser.find_element_by_id("kw").send_keys(u"selenium") browser.find_element_by_id("su").click() for i in range(4): time.sleep(3) browser.find_element_by_partial_link_text("下一页").click() body = browser.find_element_by_tag_name("body"); if "github" in body.text.encode("utf-8"): print("---Found it---") else: print("---Not Found!---") print("page:" + str(i)) time.sleep(6) browser.quit()
Python Selenium百度搜索翻页查找文字
内容版权声明:除非注明,否则皆为本站原创文章。