空手道中无法获取背景颜色

问题描述 投票:0回答:1

我有这个代码:

<div class="react-data-field separated-area case-overview-field-root important">
    <div class="row">
        <div class="col-xs-6">
               <div class="data-label">Test is important</div>
        </div>
        <div class="col-xs-6"><div class="data-value">
               <div class="easy-edit-wrapper">Click to edit</div>
        </div>
    </div>
</div>

我使用此代码来匹配行的背景颜色:

* match script("//div[text()='Test - is important']", "function(e){ return getComputedStyle(e)['background-color']}") == "#7d7d80"

问题在于该行的背景颜色仅位于具有“重要”类别的父级 div 中。 我该如何检查家长?

parent-child karate background-color
1个回答
0
投票

也许可以尝试

getComputedStyle(e.parentElement)

只要是JS可以的-空手道都可以执行。我不确定“重要”部分。你可以尝试在浏览器开发者工具中的控制台运行JS并实验。

© www.soinside.com 2019 - 2024. All rights reserved.