解决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)
每天进步一点点!
原文地址:https://www.cnblogs.com/qianjunjun/p/13362006.html