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

  • 相关阅读:
    hive+mysql安装
    (转)hive sql 学习笔记(1)
    「CSPS 2020」动物园
    「CSPS 2019」Emiya 家今天的饭
    「CSPS 2020」儒略日
    「CSPS 2019」划分
    poj2251 Dungeon Master 搜索BFS
    poj1080 Human Gene Functions
    poj2349最小生成树prim算法
    hoj1356 Miller_Rabbin算法
  • 原文地址:https://www.cnblogs.com/cpas-3-org/p/13813198.html
Copyright © 2011-2022 走看看