zoukankan      html  css  js  c++  java
  • selenium

    八种方法:

    find_elements_by_id()
    find_elements_by_name()
    find_elements_by_class_name()
    find_elements_by_tag_name()
    find_elements_by_link_text()
    find_elements_by_partial_link_text()
    find_elements_by_xpath()
    find_elements_by_css_selector()
    

      

    实例:

    from selenium import webdriver
    from time import sleep
    
    driver = webdriver.Chrome()
    driver.get("http://www.baidu.com")
    
    driver.find_element_by_id("kw").send_keys("selenium")
    driver.find_element_by_id("su").click()
    sleep(5)
    
    texts = driver.find_elements_by_xpath("//div/h3/a")
    
    for t in texts:
        print(t.text)
    
    driver.quit()
    

      

    运行结果:

    selenium
    
    selenium教程-90天从入门到高薪【学习必看】
    
    Selenium - Web Browser Automation
    Selenium_百度百科
    Selenium - Web Browser Automation
    官网
    功能自动化测试工具——Selenium篇
    自动化测试工具Selenium入门 - CSDN博客
    python爬虫从入门到放弃(八)之 Selenium库的使用 - pytho..._博客园
    selenium用法详解 - 道高一尺 - 博客园
    selenium中文网 – selenium安装、selenium使用、selenium中文、...
    selenium-CSDN下载
    selenium自动化测试资源整理(含所有版本chrome、chrome..._CSDN博客
    自动化测试_2017新编自动化测试selenium课程
    
    selenium_"0基础"到熟练只要4个月_月薪过万不是梦
    
    【亚马逊】买selenium就上Z.CN_亚马逊海外购大牌"惠"聚_一键真..
    

      

    参考资料:http://www.testclass.net/selenium_python/elements/

  • 相关阅读:
    [Leetcode] 225. Implement Stack using Queues
    前端面试题2
    数据结构_stack
    数据结构 station
    数据结构_wow(泡泡的饭碗)
    数据结构_XingYunX(幸运儿)
    数据结构 nxd(顺序对)
    数据结构 hbb(汉堡包)
    数据结构 elegant_sequence(优雅的序列)
    数据结构 i_love(我喜欢)
  • 原文地址:https://www.cnblogs.com/studyddup0212/p/9029063.html
Copyright © 2011-2022 走看看