<div id="Form_Scope1" class="Form_Scope topLevel CoachView CoachView_show" data-eventid="" data-viewid="Form_Scope1" data-config="config1" data-bindingtype="" data-binding="" data-type="com.ibm.bpm.coach.Snapshot_a30ea40f_cb24_4729_a02e_25dc8e12dcab.Form_Scope">
<div id="Action_Group2" class="Action_Group topLevel CoachView CoachView_show" data-eventid="" data-viewid="Action_Group2" data-config="config9" data-bindingtype="" data-binding="" data-type="com.ibm.bpm.coach.Snapshot_a30ea40f_cb24_4729_a02e_25dc8e12dcab.Action_Group">
<div id="div_5_1" class="ContentBox" data-view-managed="true" style="display: none;"> </div>
<div class="s-action-group clearfix sticky">
<div class="l-nodeId" style="">QTO001_N002A</div>
<div class="p-action-group">
<div id="div_5_1_1" class="Action CoachView CoachView_show" data-eventid="boundaryEvent_7" data-viewid="Action3" data-config="config15" data-bindingtype="" data-binding="" data-type="com.ibm.bpm.coach.Snapshot_a30ea40f_cb24_4729_a02e_25dc8e12dcab.Action">
<button id="div_5_1_1-lnk" class="p-primary-btn btn btn-primary" type="button" title="" data-original-title="" style="background-color: rgb(56, 168, 182);">
<i class="icon-indent-right"></i>
<span>Submit quote</span>
</button>
<a href="#action" style="display: none;">
</div>
如何点击“提交报价”按钮 1.id =“div_5_1_1-lnk”=一页申请表 2.id =“div_9_1_1-lnk”=另一页申请 在不同的应用程序页面中动态变化。 我已尝试通过位置或相对路径的xpath表达式它不起作用请告诉我任何其他可用的选项?
答案 0 :(得分:1)
以下选择器可以使用,
driver.findElement(By.cssSelector("div.Action button[id$='lnk']"));
这里'$'表示按钮的id应以'lnk'值结束。
The equals sign in attribute selectors may be prefaced by other characters which alter the meaning a bit.
Remember that classes and ID's are attributes too, and can be used with attribute selectors.
答案 1 :(得分:0)
尝试driver.findElement(By.cssSelector("button[id^='div_']"));
答案 2 :(得分:0)
使用班级名称
单击它options=driver.find_elements_by_class_name("icon-indent-right")
for option in options:
if(option.text=="Submit quote"):
option.click()