我有<span class="percent-complete-bar" style="width: 85%; background: green;"></span>
之类的元素,我想检查style
属性是否包含width: xx%;
r'width: \d{1,3}%;'
await bar.attributes['style']
返回width: 85%; background: green;
答案 0 :(得分:2)
expect(await bar.attributes['style'], matches(r'width: \d{1,3}%;'));