单击Jquery对话框UI按钮,Selenium使用PhpUnit(PhpUnit\u Extensions\u SeleniumTestCase)
我正在使用jquery对话框UI开发一个应用程序 我们有一个具有这种行为的屏幕:如果不同的规则匹配,则在单击表单提交按钮后会链接一个或多个jQueryUI对话框 使用Phpunit SeleniumTestCase查看扩展Phpunit_Extensions_SeleniumTestCase和Selenium RC我试图单击这些对话框的按钮来模拟测试 不幸的是,它不起作用,我不能使用XPath,因为对话框的数量不同,并且每个对话框的XPath与显示规则匹配也不同。因此,我决定在按钮上设置ID,例如我们正在使用的典型UI对话框:单击Jquery对话框UI按钮,Selenium使用PhpUnit(PhpUnit\u Extensions\u SeleniumTestCase),jquery,jquery-ui,selenium,phpunit,Jquery,Jquery Ui,Selenium,Phpunit,我正在使用jquery对话框UI开发一个应用程序 我们有一个具有这种行为的屏幕:如果不同的规则匹配,则在单击表单提交按钮后会链接一个或多个jQueryUI对话框 使用Phpunit SeleniumTestCase查看扩展Phpunit_Extensions_SeleniumTestCase和Selenium RC我试图单击这些对话框的按钮来模拟测试 不幸的是,它不起作用,我不能使用XPath,因为对话框的数量不同,并且每个对话框的XPath与显示规则匹配也不同。因此,我决定在按钮上设置ID,例
<div class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-dialog-buttons ui-draggable ui-resizable" style="position: absolute; height: auto; width: 300px; top: 343px; left: 487px; display: block;" tabindex="-1" role="dialog" aria-describedby="ui-id-10" aria-labelledby="ui-id-11">
<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
<span id="ui-id-11" class="ui-dialog-title">Attention</span>
<button class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-dialog-titlebar-close" role="button" aria-disabled="false" title="close">
<span class="ui-button-icon-primary ui-icon ui-icon-closethick"/>
<span class="ui-button-text">close</span>
</button>
</div>
<div id="ui-id-10" style="display: block; width: auto; min-height: 88px; max-height: none; height: auto;" class="ui-dialog-content ui-widget-content">Le champ n° de secours n'a pas été renseigné; acceptez-vous qu'il soit affecté par défaut avec la valeur du ND cible?</div>
<div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix">
<div class="ui-dialog-buttonset">
<button type="button" id="popup_numero_secours_yes" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text">Oui</span>
</button>
<button type="button" id="popup_numero_secours_no" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text">Non</span>
</button>
<button type="button" id="popup_numero_secours_cancel" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false">
<span class="ui-button-text">Annuler</span>
</button>
</div>
</div>
<div class="ui-resizable-handle ui-resizable-n" style="z-index: 90;"/>
<div class="ui-resizable-handle ui-resizable-e" style="z-index: 90;"/>
<div class="ui-resizable-handle ui-resizable-s" style="z-index: 90;"/>
<div class="ui-resizable-handle ui-resizable-w" style="z-index: 90;"/>
<div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se" style="z-index: 90;"/>
<div class="ui-resizable-handle ui-resizable-sw" style="z-index: 90;"/>
<div class="ui-resizable-handle ui-resizable-ne" style="z-index: 90;"/>
<div class="ui-resizable-handle ui-resizable-nw" style="z-index: 90;"/>
</div>
甚至使用我不喜欢的按钮标签,因为不准确:
$this->getXpathCount("//button[@type=\"button\"]/span[text()=\"Oui\"]");
这也不起作用:
$this->click('id=popup_checklist_yes');
是否有人遇到此问题并已修复
提前谢谢你
$this->click('id=popup_checklist_yes');