解决python+selenium无法获取提示内容

问题场景:修改查询数据时,页面有提示信息,但是定位到提示信息的位置后,通过ele.text或者其他方法都无法获取具体的提示内容;最后通过get_attribute('innerHTML')搞定。
示例:
ele = self.driver.find_element_by_xpath("//div[2]/table/tbody/tr/td")
msg = ele.get_attribute('innerHTML')
if msg == '无符合条件的记录':
actual = 'search-fail'
else:
actual = 'search-success'
self.assertEqual(actual,expect)
posted @ 2020-07-22 17:17  千君君  阅读(760)  评论(0编辑  收藏  举报