海上月明

          editer by sun
          posts - 162, comments - 51, trackbacks - 0, articles - 8
             :: 首頁 :: 新隨筆 ::  :: 聚合  :: 管理

           

              def getTdOfTableContains(self,table,conText):

                  #add 20130607 by sho

                  #find first td in table and td's innertext contains conText

                  for cell in table.cells:

                      if conText in cell.innertext:

                          return cell

                  return None

           

              def getTrOfTableContains(self,table,conText):

                  #add 20130607 by sho

                  #find first tr in table and tr's cells contains conText

                  td=self.getTdOfTableContains(table,conText)

                  if td:

                      return self.getElementParent(td)

                  else:

                      return None

          測(cè)試代碼:

           

          *** 遠(yuǎn)程解釋器再初始化了  ***

          >>> from PAM30 import PAMIE

          >>> ie=PAMIE("http://1.1.1.1/query/itemQueryAction.do?method=jumpToSingleItemTrackQuery")

          >>> ie.setTextBox("itemno","1191590659011")

          True

          >>> ie.submitForm("itemQueryForm")

          True

          >>> tb4=ie.findElement("table","classname","table4")

          >>> tr_sj=ie.getTrOfTableContains(tb4,u"收寄")

          >>> print tr_sj.outerhtml

           

           

          主站蜘蛛池模板: 靖西县| 奎屯市| 漾濞| 武鸣县| 姚安县| 石景山区| 三河市| 梅州市| 和田县| 永吉县| 兴安盟| 珲春市| 云林县| 牟定县| 遵义县| 栾川县| 平塘县| 大埔县| 翁牛特旗| 嘉义县| 那坡县| 大宁县| 呈贡县| 丽水市| 巴马| 莱西市| 阿克陶县| 辽中县| 水城县| 大港区| 东辽县| 安陆市| SHOW| 闽清县| 古丈县| 南木林县| 长阳| 西昌市| 柞水县| 绥江县| 南阳市|