zoukankan      html  css  js  c++  java
  • WebDriver CSS、By定位

    WebDriver CSS、By定位

    百度搜索输入框

    class定位:

    find_element_by_css_selector(".s_ipt")

    id定位:

    find_element_by_css_selector(".kw")

    tag定位 :

    find_element_by_css_selector("input")

    tag层级:

    find_element_by_css_selector("span > input")

    属性:

    find_element_by_css_selector("[name=kw]")

    组合定位:

    find_element_by_css_selector("from#from > span >input#kw")

    字符串:

    find_element_by_css_selector("[class*s_ipt_wr]") #class 属性含wr的字符串

    find_element_by_css_selector(“[class^=s])#class以s字符串开头的

    find_element_by_css_selector(”[class$=wr]")#class以wr字符串结尾的

    find_element_by_css_selector("from > input:nth-chind(2)")#标签下面的第2个input的因素

    find_element_by_css_selector("from > input:nth-last-child(1) ") #选择倒数第一个p元素



    By定位:

    #导入 from selement.webdriver.common.by import By

    find_element(By.ID,"kw")

    find_element(By.NAME,"WD")

    find_element(By.CLASS_NAME,"s_ipt")

    find_element(By.TAG_NAME,"input")

    find_element(By.LINK_TEXT,"新闻")

    find_element(By.PARTIAL_LINK_TEXT,"新")

    find_element(By.XPATH,"//*【@class='bg s_btn']")

    find_element(By.CSS_SELECTOR,"span.bg s_btn_wr>input#su")

  • 相关阅读:
    flash 异性窗体
    ASCⅡ 表 关键字符
    VC 中显示位图的步骤
    输出电脑的所有Mac地址
    const char* 和 char* const
    C# 生成PDF
    vc6显示行号
    纪念一下。
    MII接口全家福
    Virtex6 GTX设计总结:预加重、均衡、输出振幅的值
  • 原文地址:https://www.cnblogs.com/cpas-3-org/p/13813198.html
Copyright © 2011-2022 走看看