Implicit wait issues due to undefined message box


#1

Hello,

Looking to see if I can get some insight. I an opening a URL and it launches a security javascript function which just provides a system privacy disclaimer (OK/Cancel), nothing in seems to be able to ‘identify’ this box to reference a confirmation function. The logic never progresses to the next command (send ${KEY_ENTER} to select OK) because the page never loads, I’ve tried reducing the page wait settings and it just loses heartbeat and says macro fail.

How do I specifically turn off implicit waiting? I would rather send the open URL command and manually build in a pause/wait, etc.


#2

Can you share url so we could have a look?


#3

I agree with @commensal, having the URL would be best.

If you can not share it, then I suggest you try the new XType command to send ${KEY_ENTER}. Unlike the standard Javascript sendkey, XType does not operate on the page, so the command should be executed ok. Please let us know if this solution works for you.


#4

Unfortunately cannot share as it is behind a private firewall. Functions in Kantu are:

Open
Https://igo.verizon.com

XType
${KEY_ENTER}

But it never gets to the Enter command because the page never loads due to subsequent JavaScript confirm popup even with pagewait set to 1


#5

Ok, I see the problem now: By design, the open command implicitly waits for the page to load, which never happens in your case. So as you said, you need some kind of “negative” WaitForPageToLoad command.

Luckily this can be done with the storeEval command and some Javascript:

toreEval | this.document.location.href = “https://your-page-url.com

=> this triggers the page load, but does not wait for anything, and moves on to the next command.

Here is a test macro. You first load a normal page, and then use storeEval for the page with the dialog.

As for your custom wait logic, in addition to commands like Pause or AssertText, you can also use visualAssert to wait for a certain image.

{
  "CreationDate": "2018-10-28",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://en.wikipedia.org/wiki/Cambridge_University",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "start page load at ${!runtime}",
      "Value": "blue"
    },
    {
      "Command": "storeEval",
      "Target": "this.document.location.href = \"https://a9t9.com/kantu/docs\"",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "Done with the command at ${!runtime} <= we did NOT wait",
      "Value": "green"
    }
  ]
}


#6

You’ve solved the main issue! The script continues to run after redirecting to my intended destination. I added the pause and by time the pause expires the dialog box has appeared, however the XType !{KEY_ENTER} isnt closing the javascript box even though I could hit Enter myself at that point and it closes. Suggestion?

Current script:

{
“CreationDate”: “2018-10-29”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://vzweb2.verizon.com/”,
“Value”: “”
},
{
“Command”: “echo”,
“Target”: “Start page load at ${!runtime}”,
“Value”: “”
},
{
“Command”: “storeEval”,
“Target”: “this.document.location.href= “https://igo.verizon.com””,
“Value”: “”
},
{
“Command”: “echo”,
“Target”: “Done with the command at ${!runtime}”,
“Value”: “”
},
{
“Command”: “pause”,
“Target”: “8000”,
“Value”: “”
},
{
“Command”: “XType”,
“Target”: “!{KEY_ENTER}”,
“Value”: “”
}
]
}


#7

Some questions:

  • Are you using Kantu for Chrome or Firefox?
  • If you close manually, do you just hit “Enter” or do you first need to put the focus on the dialog?
  • Last but not least, a screenshot of the situation would help to clarify this :wink:

#8

I am using Kantu for Chrome.

I can just hit Enter, the javascript dialog makes it bring-to-front:
if (window != top) window.parent.location.reload();


#9

Disregard last item… I figured out my silly issue. I was putting !{KEY_ENTER} instead of ${KEY_ENTER}. All good now!


#10

Ah… these things happen :wink: It’s great to hear that all works now.