1. 程式人生 > >selenium Message: invalid selector: The result of the xpath expression

selenium Message: invalid selector: The result of the xpath expression

selenium的xpath表示式寫錯了, selenium不支援xpath中直接獲取text
 

錯誤程式碼示例 :

driver.find_element_by_xpath('//*[@class="signTime"]/text()')
正確程式碼示例 : 

driver.find_element_by_xpath('//*[@class="signTime"]').text