zoukankan      html  css  js  c++  java
  • selenium入门:Xpath定位-绝对定位

    Xpath定位

        Xpath即为XML路径语言,它是一种用来确定XML文档中某部分位置的语言。XPath基于XML的树状结构,提供在数据结构树中找寻节点的能力。

    from selenium import webdriver

    from time import sleep

    driver=webdriver.Firefox()

    driver.find_element_by_xpath("/html/body/div[2]/div[1]/div/div[1]/div/form/span[1]/input").send_keys("***")

    driver.find_element_by_xpath("//input[@id='kw']").send_keys("selenium")

    driver.find_element_by_xpath("//input[@name='wd']").send_keys("selenium")

    driver.find_element_by_xpath("//*[@class='s_ipt']").send_keys("python3")

    driver.find_element_by_id("su").click()

    sleep(3)

    driver.quit()

  • 相关阅读:
    2020年3月22日
    2021年3月21日
    2021年3月20日
    人件集阅读笔记02
    2021年3月19日
    2021年3月18日
    2021年3月17日
    2021年3月16日
    2021年3月15日
    梦断代码阅读笔记01
  • 原文地址:https://www.cnblogs.com/luckerzhang/p/9341806.html
Copyright © 2011-2022 走看看