1

I am building one chrome extension for capturing funds from BigCommerce admin. But BigCommerce admin seems to be built by angular (I do not know how angular work), and I can NOT get the capture button element from source code, which is dynamically added by angular iframe, like ajax.

<iframe id="content-iframe" class="cp-iframe" frameborder="0"
        ng-idle-watch-iframe="" iframe-manager="" post-message=""
        ng-class="{ 'ui-hidden': !(MainCtrl.isIframeActive('cp')) }"
        name="cp-iframe" ui-interaction="">
</iframe>

I can get the order detail page like: your-bigcommerce-domain.com/admin/order/{order_id}/details

the result like:

enter image description here

We can find the "capture funds" button, but it is NOT clickable.

I only can see clickable capture button via browser inspect.

enter image description here

whether can the jquery get elements from "inspect" instead of source code ?

enter image description here

the action link of capturing fund is
your-domain.com/admin/order/{order-id}/capture-funds?authenticity_token=b3d4*************51b46abbdc1d9

but I do not know where the authenticity_token is from.

Actually, I have already tried below way to wait chrome browser to finish loading all elements:

setTimeout(function()
{
    console.log($('button.capture-trigger').length);
    $('button.capture-trigger').click();
}, 6000);

but it is still not working. do you have any other ideas please ?

georgeawg
  • 48,608
  • 13
  • 72
  • 95
Fresh Lover
  • 470
  • 1
  • 8
  • 26

1 Answers1

0

Unfortunately, you can't access the DOM of the iframe from a Chrome extension (see, for example, access iframe content from a chrome's extension content script).

Jacob Brazeal
  • 654
  • 9
  • 16
  • Strictly speaking you can access it, just as shown in the linked topic. I guess a better phrasing would be "you can't access the DOM of a cross-origin iframe directly from your main content script so you'll need to run another content script in the iframe and use messaging to coordinate data extraction". – wOxxOm Sep 23 '19 at 17:31