Share via

edge browser control executejavascript method

Anonymous
2024-06-19T05:36:34+00:00

jsCode = "document.querySelector(""#form_arap_bxbusitem\&childform2 > div > div > div.vat_amount.js-type-number.form-item > div.form-item-control > div > span > div > div > div > div > input"").value = 8888"

me.edgebrowser.executejavascript(jscode)

executed successfully in chrome devtools console,but failed in vba

web page with frames

Microsoft 365 and Office | Access | Other | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2024-06-28T02:47:16+00:00

https://filetransfer.io/data-package/DoMYNUWt#link

thanks

用友的bip

Thanks for your feedback.

I have found two level iframes nested.

So in Access webview need grasp the element from the first level.

<script>

//<iframe id="forwardFrame" src="./新增_境内差旅费报销单_files/index.html" frameborder="0" height="100%" width="100%"></iframe>

///storage/emulated/0/Download/2/新增_境内差旅费报销单.html

//<iframe fieldid="main_iframe" id="mainiframe" class=" iframeIndex" frameborder="0" scrolling="0" src="./index(10).html" style="width: 100%; height: 100%;">

///storage/emulated/0/Download/2/新增_境内差旅费报销单_files/index.html

///storage/emulated/0/Download/2/新增_境内差旅费报销单_files/index(10).html

function myFunction() {

var elmnt = document.getElementById('forwardFrame'); 

 alert(elmnt.outerHTML)

var elmnt2 = elmnt.contentWindow.document.getElementsByTagName("iframe")[0];

 alert(elmnt2.outerHTML)

var elmnt3 = elmnt2.contentWindow.document.getElementsByTagName("input")[3];

elmnt3.value=888; 

}

// var elmnt3 = elmnt2.contentWindow.document.body;

 //alert(elmnt3.outerHTML)

/*

var elmnt = iframe.contentWindow.document.getElementsByTagName("input")[3]; 

alert(elmnt.outerHTML)

elmnt.value=888

*/

</script>

https://filetransfer.io/data-package/yS8d5EQq#link

js in VBA may like this.

jsCodes="var elmnt = document.getElementById('forwardFrame');

 alert(elmnt.outerHTML)

var elmnt2 = elmnt.contentWindow.document.getElementsByTagName(""iframe"")[0];

 alert(elmnt2.outerHTML)

var elmnt3 = elmnt2.contentWindow.document.getElementsByTagName(""input"")[3];

elmnt3.value=888; "

//单据日期

I have dissabled all css and js

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

21 additional answers

Sort by: Most helpful
  1. Anonymous
    2024-07-05T05:10:38+00:00

    按键精灵暂不考虑

    i will try fiddler if i have interest and time.

    thanks

    Was this answer helpful?

    0 comments No comments