【发布时间】:2021-02-20 15:29:29
【问题描述】:
我正在尝试使用选择器过滤svg 图表上的元素:Selector('.joint-type-mapping-record .v-line').withText('testElement')。但结果是收到一条消息,提示在 DOM 中找不到元素。
我检查了innerText 可用于<tspan>,但它不是。然后我尝试添加 customDOMProperties (addCustomDOMProperties({ innerText: (el) => el.innerText });),但出现错误:1) TypeError: Cannot redefine property: innerText
有什么方法可以使用withText() 处理<tspan>?
这里是页面代码:
<g model-id="6c1b0506-321a-4c27-8a06-7f2bfa5851ed" data-type="mapping.Record" id="j_488" class="joint-cell joint-type-mapping joint-type-mapping-record joint-element joint-theme-default" magnet="false" transform="translate(-171,99)">
<text joint-selector="headerLabel" id="v-11781" font-size="20" xml:space="preserve" font-family="Galano Grotesque" font-weight="500" text-anchor="middle" text-vertical-anchor="middle" fill="#333333" transform="matrix(1,0,0,1,109,15)">
<tspan dy="0.3em" class="v-line">testElement</tspan></text></g>
【问题讨论】:
标签: svg automated-tests e2e-testing testcafe tspan