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")

  • 相关阅读:
    GLSL预定义变量
    GLSL 内建函数
    GLSL语言基础
    svn:revert to this version 和 revert changes from this version的区别
    win7下搭建opengles2.0编程环境
    iconv字符编码转换
    矩阵-DirectX与OpenGL的不同
    NHibernate分页
    Web网站压力测试工具
    winform系统自动登录实现
  • 原文地址:https://www.cnblogs.com/cpas-3-org/p/13813198.html
Copyright © 2011-2022 走看看