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

Get data from web page using JavaScript in BluePrism

有人能告诉我如何在 Blue Prism 中使用导航阶段 Invoke JavaScript 或 [=13= 中的操作将网页中的数据导入 数据项 ]?

例如我使用函数:

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

我想将这个 return 值放入 Blue Prism 中的数据项中进行处理。

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

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

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

我使用以下脚本添加文本框and/or清除它的值...

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!"

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