简体   繁体   English

如何使用UFT在对话框上单击确定

[英]How to click ok on a dialog box using UFT

I got a weird dialog box in web application testing and I am just stuck. 我在Web应用程序测试中遇到了一个奇怪的对话框,而我只是被卡住了。 Dialog box is a conditional. 对话框是有条件的。 It displays based on some data we enter. 它根据我们输入的一些数据显示。 I just need to be able to click OK or press enter if it displays. 我只需要能够单击OK或按Enter(如果显示)。

在此处输入图片说明

I clicked OK while recording. 录制时单击“确定”。 UFT does not add any code and nothing was added to OR. UFT不会添加任何代码,也不会添加任何内容。 When I spy, it is not recognizing the ok and does not recognize the dialog box. 当我监视时,它无法识别正常,也无法识别对话框。 Manually I simply click OK or press enter to handle. 手动地,我只需单击“确定”或按Enter即可处理。 Then I wrote the shell way to press enter. 然后,我编写了按Enter键的shell方法。 It does not do anything. 它什么也没做。

Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{ENTER}"
Set WshShell = Nothing

How can I handle this dialog box using UFT? 如何使用UFT处理此对话框?

you can you insight object to identify the "Ok" button. 您可以洞察对象以识别“确定”按钮。 in case you are not able to spy it. 以防您无法监视它。

If this is the browser's regular dialog (javascript's alert ) UFT supports dismissing it using Browser(...).HandleDialog . 如果这是浏览器的常规对话框(javascript的alert ),则UFT支持使用Browser(...).HandleDialog将其Browser(...).HandleDialog

If this works then it should also have recorded the HandleDialog step, if it doesn't it may be a defect in UFT, I suggest contacting MicroFocus's support. 如果HandleDialog ,那么它也应该记录了HandleDialog步骤,如果HandleDialog ,则可能是UFT的缺陷,我建议联系MicroFocus的支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM