1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      如果通過當(dāng)前元素知道父元素、同級元素

      基本的思路是知道了當(dāng)前元素,可以通過xpath的方法找到父元素,知道了父元素之后,就可以通過父元素找子元素的方法找到同級元素。 以百度搜索輸入框?yàn)槔樱业捷斎肟虻母冈兀环N是通過..來選擇,另外一種通過xpath 軸來尋找,代碼如下:

      成都創(chuàng)新互聯(lián)從2013年開始,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目成都網(wǎng)站制作、網(wǎng)站設(shè)計網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元樂山做網(wǎng)站,已為上家服務(wù),為樂山各地企業(yè)和個人服務(wù),聯(lián)系電話:13518219792

      from selenium import webdriver
      import time
      driver = webdriver.Firefox()
      driver.get('https://www.baidu.com/?tn=80035161_1_dg&ocid=msncn')
      childrenelement = driver.find_element_by_id('kw')
      #'.' 表示當(dāng)前節(jié)點(diǎn) ,'.. '表示父節(jié)點(diǎn)#
      #parentelement = childrenelement.find_element_by_xpath('./..')
      # xpath軸 parent
      parentelement = childrenelement.find_element_by_xpath('parent::*')

      print(parentelement.get_attribute('class'))

      如果通過當(dāng)前元素知道父元素、同級元素


      分享文章:如果通過當(dāng)前元素知道父元素、同級元素
      網(wǎng)頁路徑:http://www.ef60e0e.cn/article/jhgjgd.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        康乐县| 孝义市| 天祝| 梅州市| 德昌县| 横峰县| 广东省| 无锡市| 太湖县| 阜南县| 道孚县| 通州区| 临潭县| 汽车| 彰化市| 蒲江县| 申扎县| 勐海县| 苗栗县| 衡南县| 弋阳县| 贺州市| 盐源县| 金沙县| 萨迦县| 永州市| 巴彦淖尔市| 天门市| 普兰县| 兴安盟| 泽库县| 高碑店市| 临沂市| 佛冈县| 新泰市| 酒泉市| 鹤壁市| 天祝| 手机| 庆安县| 威宁|