selenium选择器_css属性选择器

<button class="btn-search tb-bg" type="submit" data-spm-click="gostr=/tbindex;locaid=d13">搜索</button>

css属性选择器

element = self.wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR,"button[type=submit]")))
可点击的链接:element = self.wait.until(EC.find_element_by_link_text((By.CSS_SELECTOR,"搜索")))
element Out[15]: <selenium.webdriver.remote.webelement.WebElement (session="3bd0dd5c8ca225f8348e34e54c0dcc4c", element="0.8818707456837536-1")>

 

调用driver的page_source属性获取页面源码

pageSource = driver.page_source

 

要查找包含特定文本的标签,要使用

from pyquery import PyQuery as pq
doc=pq(open_url_respons.page_source)

    doc('p:contains("金额")')
Out[122]: [<p>, <p>, <p>, <p>, <p>, <p>, <p>, <p>]

posted @ 2018-10-31 23:02  zhangdingqu  阅读(1358)  评论(0编辑  收藏  举报