请问,如何从这个html中获取文本“没有事件,请稍后再试”
...</option></select><!-- --></div><div class="media_container__no-match-tracker"><div><div><div class="icon icon--football icon--size_auto"></div><div class="icon icon--volleyball icon--size_auto"></div><div class="icon icon--handball icon--size_auto"></div><div class="icon icon--hockey icon--size_auto"></div><div class="icon icon--basketball icon--size_auto"></div><div class="icon icon--tennis icon--size_auto"></div></div> There is no event, try later. </div></div></div></div></div><div class="app_column__bottom_row" data-v-eb1959b8=""><div class="app_column__bottom_row_wrapper" data-v-eb1959b8=""><div class="app_column__bottom_row_content" data-v-eb1959b8=""><div class="tab_menu chatMenu" data-v-4d018892="" data-v-eb1959b8=""><div ...
我尝试:
driver.find_element_by_xpath('/html/body/div[1]/div[3]/div[2]/div/div/div[1]/div/div[2]/div[2]/div')
但只返回:
<selenium.webdriver.remote.webelement.WebElement (session="d79e3bdd44586c81ae5922410f0c20dd", element="405526fe-7e1a-4552-af5a-70cfb341e129")>
我使用Python3,硒,bs4,无头铬。多谢各位
阅读代码和html有点困难,但请尝试以下xpath定位器:
并返回元素的文本:
@DMart
谢谢,这是我需要的。我能再问一个问题吗?站点是动态的,所以这个元素并不是每一个代码中我都能找到的。如果没有,这个驱动程序。找到。。。返回:
我怎样才能把它作为条件呢?如果元素在站点上,则打印它,如果不打印(“元素不在此url上”)
相关问题 更多 >
编程相关推荐