Adobe DTM 选择器链不工作?
Adobe DTM Selector Chain Not Working?
我正在尝试使用 CSS 选择器链使用下面代码中的数据元素获取路由号码,但我不知道为什么我无法获取文本(路由号码)对以下代码使用 CSS 选择器链:
<table class="rich-table home table" id="startForm:PendingReviewApps" border="0" cellpadding="0" cellspacing="0"><colgroup span="0"></colgroup><thead class="rich-table-thead"><tr class="rich-table-header "><th class="rich-table-headercell " scope="colgroup">Accounts Being Reviewed</th></tr></thead><tbody id="startForm:PendingReviewApps:tb"><tr class="rich-table-row rich-table-firstrow "><td class="rich-table-cell " id="startForm:PendingReviewApps:0:ProductSummaryForDepositApplicationId" style="width:80%"><span id="startForm:PendingReviewApps:0:ProductLabelForDepositAppId" style="font-size:14pt;">Easy Checking</span>
<br />
<p style="padding-left: 20px"><span id="startForm:PendingReviewApps:0:routingNumberSpan">
Routing number:<span id="startForm:PendingReviewApps:0:RountingNumberForDepositAppId" style="font-weight:bold;"> 121100782</span>
<br /></span><span id="startForm:PendingReviewApps:0:intFundingAmtSpan">
Initial funding amount: $<span id="startForm:PendingReviewApps:0:InitialFundingAmountForDepositAppId" style="font-weight:bold;">100.00</span>
<br /></span>
</p></td></tr></tbody></table>
我已经尝试了所有类型的组合,但我使用的工具 (Adobe DTM) 没有返回文本值(路由号码)?附件是我在开发中看到的 CSS 选择器链结果。 Chrome 的控制台,但没有成功使用!我尝试了以下方法:
span#startForm:PendingReviewApps:0:RountingNumberForDepositAppId
p #startForm:PendingReviewApps:0:RountingNumberForDepositAppId
但是运气不好?
这是数据元素
这里是 Chrome 开发者的截图。显示 CSS 选择器路径的控制台:
两个选项:
(单个)转义冒号
span#startForm\:PendingReviewApps\:0\:RountingNumberForDepositAppId
最终 DTM 进行 document.querySelector()
调用,将您的值作为参数传递。
在这种情况下,尽管冒号 :
是有效的 id 字符,但它在 css 语法中标记了 pseudo-class,因此您必须将其转义。
同时,document.querySelector()
接受一个字符串参数,反斜杠是字符串的特殊字符,所以你必须转义转义(所以整体\:
)。
但是,DTM 会自动转义反斜杠,因此您只应在数据元素字段中将其转义 一次,最终评估的值将是双重转义的 \:
使用属性语法
span[id="startForm:PendingReviewApps:0:RountingNumberForDepositAppId"]
这是使用 Attribute syntax 的备用选择器。与第一种方法相比,这种方法没有真正的好处,只是您不必担心转义冒号。
我正在尝试使用 CSS 选择器链使用下面代码中的数据元素获取路由号码,但我不知道为什么我无法获取文本(路由号码)对以下代码使用 CSS 选择器链:
<table class="rich-table home table" id="startForm:PendingReviewApps" border="0" cellpadding="0" cellspacing="0"><colgroup span="0"></colgroup><thead class="rich-table-thead"><tr class="rich-table-header "><th class="rich-table-headercell " scope="colgroup">Accounts Being Reviewed</th></tr></thead><tbody id="startForm:PendingReviewApps:tb"><tr class="rich-table-row rich-table-firstrow "><td class="rich-table-cell " id="startForm:PendingReviewApps:0:ProductSummaryForDepositApplicationId" style="width:80%"><span id="startForm:PendingReviewApps:0:ProductLabelForDepositAppId" style="font-size:14pt;">Easy Checking</span>
<br />
<p style="padding-left: 20px"><span id="startForm:PendingReviewApps:0:routingNumberSpan">
Routing number:<span id="startForm:PendingReviewApps:0:RountingNumberForDepositAppId" style="font-weight:bold;"> 121100782</span>
<br /></span><span id="startForm:PendingReviewApps:0:intFundingAmtSpan">
Initial funding amount: $<span id="startForm:PendingReviewApps:0:InitialFundingAmountForDepositAppId" style="font-weight:bold;">100.00</span>
<br /></span>
</p></td></tr></tbody></table>
我已经尝试了所有类型的组合,但我使用的工具 (Adobe DTM) 没有返回文本值(路由号码)?附件是我在开发中看到的 CSS 选择器链结果。 Chrome 的控制台,但没有成功使用!我尝试了以下方法:
span#startForm:PendingReviewApps:0:RountingNumberForDepositAppId
p #startForm:PendingReviewApps:0:RountingNumberForDepositAppId
但是运气不好?
这是数据元素
这里是 Chrome 开发者的截图。显示 CSS 选择器路径的控制台:
两个选项:
(单个)转义冒号
span#startForm\:PendingReviewApps\:0\:RountingNumberForDepositAppId
最终 DTM 进行 document.querySelector()
调用,将您的值作为参数传递。
在这种情况下,尽管冒号 :
是有效的 id 字符,但它在 css 语法中标记了 pseudo-class,因此您必须将其转义。
同时,document.querySelector()
接受一个字符串参数,反斜杠是字符串的特殊字符,所以你必须转义转义(所以整体\:
)。
但是,DTM 会自动转义反斜杠,因此您只应在数据元素字段中将其转义 一次,最终评估的值将是双重转义的 \:
使用属性语法
span[id="startForm:PendingReviewApps:0:RountingNumberForDepositAppId"]
这是使用 Attribute syntax 的备用选择器。与第一种方法相比,这种方法没有真正的好处,只是您不必担心转义冒号。