查找错误消息包含带通配符的特定子字符串

时间:2017-10-04 21:01:53

标签: python python-3.x

我有一条错误消息,如下所示,我如何使用assert确保错误消息包含“元素不可点击”? 我试过但它不起作用

assert getattr(e, 'message', str(e)) == "Element * is not clickable at point"

Message: unknown error: Element <i class="dropdown"></i> is not clickable at point (860, 345). Other element would receive the click: <div class="field">...</div> (Session info: chrome=61.0.3163.100) (Driver info: chromedriver=2.30.477690 (c53f4ad87510ee97b5c3425a14c0e79780cdf262),platform=Mac OS X 10.11.4 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 75 milliseconds Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03' Session ID: 026bc5877b6f98f4ccb50fecb690a941 Screenshot: available via screen

0 个答案:

没有答案