selenium自动化测试使用xpath定位如下报错(The result of the xpath expression "//span[@class='numrows'
作者:互联网
一、问题描述
使用python+selenium进行自动化测试定位获取标签里面的文本内容出现如下报错:
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: The result of the xpath expression "//span[@class='numrows']/font/text()" is: [object Text]. It should be an element.
二、问题分析
出现该问题原因是xpath语法书写错误,正确的应该是如下:
driver.find_element_by_xpath("//span[@class='numrows']/font").text
标签:xpath,span,text,object,selenium,numrows,报错,font 来源: https://www.cnblogs.com/lxmtx/p/16548081.html