亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在 Nightwatch 中選擇 tabindex

在 Nightwatch 中選擇 tabindex

開心每一天1111 2021-11-12 18:33:53
我試圖在我的頁面中選擇一個特定的按鈕,但 nightwatch 似乎無法找到它。如果我嘗試按類調用它,它可以工作但不會選擇我想要的按鈕<div id="btGerar_documentosLote_menu" class="ui-menu ui-menu-dynamic ui-widget ui-widget-content ui-corner-all ui-helper-clearfix ui-shadow" role="menu"><ul class="ui-menu-list ui-helper-reset"><li class="ui-menuitem ui-widget ui-corner-all" role="menuitem">enter code here<a tabindex="-1" id="lote-form-button-gerar-xml-tiss" class="ui-menuitem-link ui-corner-all" href="#" onclick="PrimeFaces.ab({s:&quot;lote-form-button-gerar-xml-tiss&quot;,u:&quot;lote-form-panel-grid-dados-lote lote-form-buttons&quot;,onst:function(cfg){PF('statusDialog').show();;},onco:function(xhr,status,args){PF('statusDialog').hide();;},f:&quot;form&quot;});return false;"><span class="ui-menuitem-text">Gerar XML TISS</span></a></li><li class="ui-menuitem ui-widget ui-corner-all" role="menuitem"><a tabindex="-1" id="lote-form-button-gerar-impressao-tiss" class="ui-menuitem-link ui-corner-all" href="#" onclick="PrimeFaces.ab({s:&quot;lote-form-button-gerar-impressao-tiss&quot;,u:&quot;form&quot;,onst:function(cfg){PF('statusDialog').show();;},onco:function(xhr,status,args){PF('statusDialog').hide();;},f:&quot;form&quot;});return false;"><span class="ui-menuitem-text">Gerar Impress?o TISS</span></a></li><li class="ui-menuitem ui-widget ui-corner-all" role="menuitem"><span class="ui-menuitem-text">Gerar Documentos Lote</span></a></li></ul></div>如果我嘗試直接選擇按鈕,即<a tabindex="-1" id="lote-form-button-gerar-xml-tiss" class="ui-menuitem-link ui-corner-all" href="#" onclick="PrimeFaces.ab({s:&quot;lote-form-button-gerar-xml-tiss&quot;,u:&quot;lote-form-panel-grid-dados-lote lote-form-buttons&quot;,onst:function(cfg){PF('statusDialog').show();;},onco:function(xhr,status,args){PF('statusDialog').hide();;},f:&quot;form&quot;});return false;"><span class="ui-menuitem-text">Gerar XML TISS</span></a>,它無法識別我的命令。把它退回給我,好像它是錯的。嘗試通過使用選擇元素 .click('li[class="ui-menuitem ui-widget ui-corner-all"]')如果有人能幫我解決這個問題,我將不勝感激。如果您想了解有關代碼的更多信息,請向我索要。
查看完整描述

1 回答

?
搖曳的薔薇

TA貢獻1793條經驗 獲得超6個贊

您應該使用 ID 來選擇它。ID 保證是唯一的。

.click("#lote-form-button-gerar-xml-tiss")

假設頁面已加載并且此元素不在 iframe 中,則上述點擊沒有理由不工作。


查看完整回答
反對 回復 2021-11-12
  • 1 回答
  • 0 關注
  • 185 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號