gpt4 book ai didi

javascript - 在 BluePrism 中使用 JavaScript 从网页获取数据

转载 作者:行者123 更新时间:2023-11-29 10:02:14 24 4
gpt4 key购买 nike

有人能告诉我如何在 Blue Prism 中使用导航阶段 Invoke JavaScriptInsert JavaSript 中的操作将数据从网页获取到 Data Item片段?

例如我正在使用函数:

function myFunction()
{var x=document.getelementById("demo").innerHTML;
return x;}

我想把这个返回值放到 Blue Prism 中的数据项中进行处理。

最佳答案

不幸的是,没有快速的方法可以做到这一点,但是有一个非常简单的解决方法。

您需要在 JavaScript 和 Blue Prism 之间创建一座“桥梁”,这两种技术都可以与之交互。在这种情况下,最简单的桥梁是 HTML 文本框。

JavaScript 可以在页面上创建和写入一个临时的、不可见的文本框,而 Blue Prism 可以监视它并从中读取。

我使用以下脚本添加文本框和/或清除其值...

if (document.getElementById("JSOutput") == null){
// Add invisible textbox
var body = document.getElementsByTagName("body")[0];
var text = document.createElement("input");
text.id = "JSOutput";
text.style.display = "none";
body.insertBefore(text, body.firstChild);
}
else {
// Clear invisible textbox
document.getElementById("JSOutput").innerText = "";
}

...然后用下面的脚本写一些东西给它。

var output = document.getElementById("JSOutput");
output.innerText = "Hello World!"

然后您可以监视或手动将元素添加到应用程序建模器中:

enter image description here

关于javascript - 在 BluePrism 中使用 JavaScript 从网页获取数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53610246/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com