Auto-close iFrame causes timeout error

Hi, I have the following situation with Kantu-Extension for Chrome on Mac

  • Click link: iFrame Opens
  • selectFrame index=1
  • Click button: iFrame Closes
  • selectFrame: relative=top (script timesout)

It’s a bit inconsistent, but it appears that if the iFrame is removed from the DOM before the “selectFrame: relative=top” fires, then it causes an error. Is there any way around this? I have tried refresh, selecting window etc etc.

This following script recreates the error:

{
“CreationDate”: “2018-9-23”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://apex.oracle.com/pls/apex/f?p=23908”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=F4155_P1000_USERNAME”,
“Value”: “test”
},
{
“Command”: “clickAndWait”,
“Target”: “id=LOGIN_BUTTON”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “//*[@id="288717661996272463_orig"]/tbody/tr[3]/td[1]/a/img”,
“Value”: “”
},
{
“Command”: “selectFrame”,
“Target”: “index=0”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “id=P2_TEST_NAME”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=P2_TEST_NAME”,
“Value”: “test3”
},
{
“Command”: “click”,
“Target”: “id=P2_TEST_TYPE”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=P2_TEST_TYPE”,
“Value”: “test4”
},
{
“Command”: “click”,
“Target”: “id=P2_TEST_CATEGORY”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=P2_TEST_CATEGORY”,
“Value”: “test5”
},
{
“Command”: “click”,
“Target”: “id=P2_TEST_DESCRIPTION”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=P2_TEST_DESCRIPTION”,
“Value”: “test6”
},
{
“Command”: “click”,
“Target”: “id=B288726381496272473”,
“Value”: “”
},
{
“Command”: “selectFrame”,
“Target”: “relative=top”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “id=R288717572237272463_search_field”,
“Value”: “”
}
]
}

1 Like

So it sounds like the issue is that

  • sometimes the iframe is there, then you need SelectFrame
  • sometimes the iframe is not there, then you do not need selectframe?

If so, have you tried wrapping the command in !errorignore statements?

store | true | !errorignore
selectFrame | relative=top 
store | false | !errorignore

With !errorignore = true the macro recovers after an error and continues.

1 Like

Thanks for the reply, but I cant get that to fix the problem, it still times-out when trying to selectFrame:relative=top. I guess that having errored it still has focus in the iFrame, so ignoring the error will have no affect. I have added a pause to the script to get it to fail more consistently (see below).

If I follow your logic then it should actually work by just pausing till the iFrame disappears and removing the selectFrame:relative=top altogether. Unfortunately, it looks to me that if the focus is in the iFrame when it disappears then Kantu ends up in limbo with no way to get back to the parent frame or window.

{
“CreationDate”: “2018-9-23”,
“Commands”: [
{
“Command”: “open”,
“Target”: “https://apex.oracle.com/pls/apex/f?p=23908”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=F4155_P1000_USERNAME”,
“Value”: “test”
},
{
“Command”: “clickAndWait”,
“Target”: “id=LOGIN_BUTTON”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “//*[@id="288717661996272463_orig"]/tbody/tr[3]/td[1]/a/img”,
“Value”: “”
},
{
“Command”: “selectFrame”,
“Target”: “index=0”,
“Value”: “”
},
{
“Command”: “pause”,
“Target”: “1000”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “id=P2_TEST_NAME”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=P2_TEST_NAME”,
“Value”: “test3”
},
{
“Command”: “click”,
“Target”: “id=P2_TEST_TYPE”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=P2_TEST_TYPE”,
“Value”: “test4”
},
{
“Command”: “click”,
“Target”: “id=P2_TEST_CATEGORY”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=P2_TEST_CATEGORY”,
“Value”: “test5”
},
{
“Command”: “click”,
“Target”: “id=P2_TEST_DESCRIPTION”,
“Value”: “”
},
{
“Command”: “type”,
“Target”: “id=P2_TEST_DESCRIPTION”,
“Value”: “test6”
},
{
“Command”: “click”,
“Target”: “id=B288726381496272473”,
“Value”: “”
},
{
“Command”: “pause”,
“Target”: “1000”,
“Value”: “”
},
{
“Command”: “selectFrame”,
“Target”: “relative=top”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “id=R288717572237272463_search_field”,
“Value”: “”
}
]
}

Bump. This is a real show stopper for me, does anyone have any other suggestions. I really like the look of Kantu and everything else is working great.

1 Like

Hi, is there any change you can give us a login to the website so that we can try to recreate the issue? Without that, it is difficult to suggest a workaround. (If possible, you can send the login details directly to us, just mention this forum post in your email)

But also: We have an upcoming new XClick command that will solve this issue for sure, at it works on the operating system level, and thus iframe or not do not matter to it :grinning: This feature be available in October, and first announced on the beta list.

Sure, it’s all in the script above.

go to: https://apex.oracle.com/pls/apex/f?p=23908

Then just enter a value for the session username.

1 Like

ah, ok!.. I will test more and get back to you.

1 Like

Have you been able to access the environment and reproduce the issue?

1 Like

Thanks for the very good test case! When I run your example I get the [error] csPostMessage: timeout 60000 ms error.
=> it seems once the dialog closes, kantu loses contact with the webpage.

This is a bug, and I created a ticket for it. So if you can, please keep this Oracle Apex test app available for a few more weeks - thanks. => in the next post I will describe a workaround :wink:

error1

test macro (with the “” fixed):

{
  "CreationDate": "2018-10-3",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://apex.oracle.com/pls/apex/f?p=23908",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=F4155_P1000_USERNAME",
      "Value": "test"
    },
    {
      "Command": "clickAndWait",
      "Target": "id=LOGIN_BUTTON",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "//*[@id=\"288717661996272463_orig\"]/tbody/tr[3]/td[1]/a/img",
      "Value": ""
    },
    {
      "Command": "selectFrame",
      "Target": "index=0",
      "Value": ""
    },
    {
      "Command": "pause",
      "Target": "1000",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=P2_TEST_NAME",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=P2_TEST_NAME",
      "Value": "test3"
    },
    {
      "Command": "click",
      "Target": "id=P2_TEST_TYPE",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=P2_TEST_TYPE",
      "Value": "test4"
    },
    {
      "Command": "click",
      "Target": "id=P2_TEST_CATEGORY",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=P2_TEST_CATEGORY",
      "Value": "test5"
    },
    {
      "Command": "click",
      "Target": "id=P2_TEST_DESCRIPTION",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=P2_TEST_DESCRIPTION",
      "Value": "test6"
    },
    {
      "Command": "click",
      "Target": "id=B288726381496272473",
      "Value": ""
    },
    {
      "Command": "pause",
      "Target": "1000",
      "Value": ""
    },
    {
      "Command": "refresh",
      "Target": "",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "relative=top",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=R288717572237272463_search_field",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=R288717572237272463_search_field",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=R288717572237272463_search_field",
      "Value": "dddd"
    },
    {
      "Command": "click",
      "Target": "id=R288717572237272463_search_button",
      "Value": ""
    }
  ]
}
1 Like

Workaround: Since the website connection is lost “tricks” like the refresh command can not help. But what helps is splitting the task in two macros and combine them in a test suite.

  • First macro: Everything until selectFrame | relative=top (which is no longer needed)
  • Second macro: Whatever you want to do afterwards :wink:

So the first macro stops after the dialog is closed, and then the second macro takes over.

Screencast (Youtube): UI Vision Forum: Automating Oracle Apex - YouTube

1 Like

Hi, that is great news thanks.

Unfortunately the work-around wont work for me as I use an APEX based testing framework to generate the scripts and then run them locally using browser extensions. Updating the framework to delivery multiple scripts would not be worth it if there is a fix in the pipeline. I can continue to use the old Selenium IDEv2 for the time being until your fix is released.

Shunt

1 Like

Hi, this doesn’t appear to be fixed in version 3.3.3. Can you let me know the status of the ticket?

Hi, we had no time to work on this yet, but plan to so soon, along with other “stop” issues like this one: Freeze or Non-responsive issue - #3 by admin - UI.Vision RPA - UI.Vision RPA Software Forum | Discuss RPA Automation, Selenium IDE and OCR API Text Recognition

2 Likes

Each new release I excitedly check to see if this is fixed, so I can start using it. Sadly, it’s still not there in 3.8.7. Any idea when it might be done?

1 Like

I will check on this and get back to you asap!

2 Likes

Thanks for your patience. We discussed it and a fix for this issue will be included in the next update. The next Kantu update is scheduled for mid-February.

I will update the post once a beta version is available.

1 Like

We found the issue. This bug is about a closing iframe silently fails the next command, which should be executed in parent frame.

Solution: Add another selectFrame before pause 1000 to fix the macro. I have done it in the macro below.

The next Kantu update will bring a better error message. But once the selectFrame is added, the macro also works with the current Kantu version.

{
  "Name": "_475_",
  "CreationDate": "2019-2-13",
  "Commands": [
    {
      "Command": "open",
      "Target": "https://apex.oracle.com/pls/apex/f?p=23908",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=F4155_P1000_USERNAME",
      "Value": "test"
    },
    {
      "Command": "clickAndWait",
      "Target": "id=LOGIN_BUTTON",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "//*[@id=\"288717661996272463_orig\"]/tbody/tr[3]/td[1]/a/img",
      "Value": ""
    },
    {
      "Command": "selectFrame",
      "Target": "index=0",
      "Value": ""
    },
    {
      "Command": "pause",
      "Target": "1000",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=P2_TEST_NAME",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=P2_TEST_NAME",
      "Value": "test3"
    },
    {
      "Command": "click",
      "Target": "id=P2_TEST_TYPE",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=P2_TEST_TYPE",
      "Value": "test4"
    },
    {
      "Command": "click",
      "Target": "id=P2_TEST_CATEGORY",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=P2_TEST_CATEGORY",
      "Value": "test5"
    },
    {
      "Command": "click",
      "Target": "id=P2_TEST_DESCRIPTION",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=P2_TEST_DESCRIPTION",
      "Value": "test6"
    },
    {
      "Command": "click",
      "Target": "id=B288726381496272473",
      "Value": ""
    },
    {
      "Command": "selectFrame",
      "Target": "relative=top",
      "Value": ""
    },
    {
      "Command": "pause",
      "Target": "1000",
      "Value": ""
    },
    {
      "Command": "comment",
      "Target": "relative=top",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=R288717572237272463_search_field",
      "Value": ""
    },
    {
      "Command": "click",
      "Target": "id=R288717572237272463_search_field",
      "Value": ""
    },
    {
      "Command": "type",
      "Target": "id=R288717572237272463_search_field",
      "Value": "dddd"
    },
    {
      "Command": "click",
      "Target": "id=R288717572237272463_search_button",
      "Value": ""
    }
  ]
}
2 Likes

I tried this and it didn’t work. It just said unable to find button “close” after I executed select frame top and pause 1000

1 Like

1

I have a script of a payment gateway:

<script src="https://assets.pagar.me/checkout/1.1.0/checkout.js"></script>

When the user click to pay an item I call the next code. It open a modal dialog into a iframe to fill data from credit card to pay the item. My app will work in kiosk mode and I´d like to close the iframe after a timeout.

I have tried:

setTimeout(function(){
     function closeWin()   // Tested Code
     {
     var someIframe=document.
       getElementById('easyXDM_PagarMeCheckout_default6958_provider')
       .contentWindow.document;
    }
    closeWin()
 },30000)

but it doesn’t work. Here is How I call the function of the script to execute a payment:

UPADATE: I achieve a way to find the iframe using:

var ifr=$('#easyXDM_PagarMeCheckout_default6958_provider', parent.document);

I am trying now:

ifr.remove()

but no success.

var checkout = new PagarMeCheckout.Checkout({
        encryption_key: 'ek_test_f9cws0bU9700VqWE4UDuBlKLbvAAA',
        success: function(data) {
          console.log(data);
        },
        error: function(err) {
          console.log(err);
        },
        close: function() {
          console.log('The modal has been closed.');
        }
      });

      var params = {
                      "amount":128000,
                      "customerData":"true",
                      "paymentMethods":"boleto,credit_card",
                      "postbackUrl":"requestb.in/1234",
                      "items": [
                        {
                          id: '1',
                          title: 'Bola de futebol',
                          unit_price: 12000,
                          quantity: 1,
                          tangible: true
                        },
                        {
                          id: 'a123',
                          title: 'Caderno do Goku',
                          unit_price: 3200,
                          quantity: 3,
                          tangible: true
                        }
                      ]
                    };
      var ck=checkout.open(params);

Here is a copy of the iframe:

<iframe name="easyXDM_PagarMeCheckout_default3498_provider" id="easyXDM_PagarMeCheckout_default3498_provider" src="https://assets.pagar.me/checkout/1.1.0/modal.html?xdm_e=http%3A%2F%2Flocalhost&amp;xdm_c=default3498&amp;xdm_p=1" frameborder="0" style="z-index: 9999; background: transparent; border: 0px none transparent; overflow-x: hidden; overflow-y: auto; margin: 0px; padding: 0px; -webkit-tap-highlight-color: transparent; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%;"></iframe>
#document
<html>
   <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
      <title>Checkout</title>
      <link href="//fonts.googleapis.com/css?family=Raleway:600,500,400" rel="stylesheet" type="text/css">
      <link href="//fonts.googleapis.com/css?family=Titillium+Web:300,300italic,400,400italic,600,600italic" rel="stylesheet" type="text/css">
      <link href="//fonts.googleapis.com/css?family=PT+Sans:400,700" rel="stylesheet" type="text/css">
      <link rel="stylesheet" href="style/pagarme-ui.css?version=5">
      <link rel="stylesheet" href="style/card.css?version=5">
      <link rel="stylesheet" href="style/icons.css">
      <link rel="stylesheet" href="style/mobile.css" media="only screen and (max-width: 600px)">
      <script async="" src="https://www.google-analytics.com/analytics.js"></script><script async="" src="//www.google-analytics.com/analytics.js"></script><script>
         (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
         m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
         })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

      </script>
      <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js"></script>
      <script src="jquery.bez.min.js"></script>
      <script src="jquery.color.min.js"></script>
      <!--[if lte IE 7]>
      <script src="json.min.js"></script>
      <![endif]-->
      <script src="raven.min.js"></script>
      <script>
         Raven.config('https://4a6f66d610de4a0ab3d822d95075cff2@sentry.pagar.me/3').install();

      </script>
      <script src="animations/default.js"></script>
      <script src="card.js"></script>