baidu首页的web自动化练习

2019-06-12  本文已影响0人  爱跑路的二哈
from selenium import webdriver 


# 创建一个FireFox的示例
driver = webdriver.Firefox()
driver.implicitly_wait(30)
driver.maximize_window()

driver.get("https://www.baidu.com/")

driver.implicitly_wait(30)
search_buttons = driver.find_elements_by_xpath("/html/body/div[1]/div[4]/div/div/p[1]/a")
print("Found " + str(len(search_buttons)) + " products:")

for product in search_buttons:
    print(product.text)
driver.quit()
  
上一篇下一篇

猜你喜欢

热点阅读