0
votes

After moving on Java 1.8 there is a security warning showing on starting web-start application.

enter image description here

UFT can see all objects of this Java dialog by object spy. So I have coded message checking and confirmation block:

If JavaDialog("label:=Security Warning").Exist(40) Then
    JavaDialog("label:=Security Warning").JavaCheckBox("text:=I accept the risk and want to run this application\.").Set True
    JavaDialog("label:=Security Warning").JavaButton("label:=Run")
End If

But during test execution even 40-seconds waiting for existance of JavaDialog("label:=Security Warning") returns False right at the moment, without waiting at all.

What is the reason for this behaviour? How to fix?

2

2 Answers

0
votes

It might be throwing an error in line 1 (line with if statment) in the background. and because of 'proceed to next step' option in File > Settings > Run, UFT is proceeding to next step and returning False to you.

Try moving Exist() outside the if statement.

strExist = JavaDialog("label:=Security Warning").Exist(40)
If strExist Then
    JavaDialog("label:=Security Warning").JavaCheckBox("text:=I accept the risk and want to run this application\.").Set True
    JavaDialog("label:=Security Warning").JavaButton("label:=Run")
End If
0
votes

If UFT is not waiting for 40 seconds, then there might be an error generated in that line.

I am able to execute the below code without any issues

if JavaDialog("label:=Security Information").Exist(40) then

Msgbox "Test"

End If

What you can do to debug this is

1) Check the UFT's run result report, that will have the error generated by UFT. That will help you in identification of issues.

2) As Yogesh suggested, turn off any error settings and comment any On error resume next statements in your script. This will make sure that UFT shows you the error instead of skipping the line.