14-03-24 02:56 PM
Can anyone help me with extracting text from the chrome element using java script?
Can anyone help me with extracting text from the chrome element using java script? I can't find de text using application moddler.
in the console of chrome develop I used this code:
document.querySelector('body > h2').innerTextI need to colect this text and use in object on blueprism
yesterday
Hi @TiagoFreitas - you can easily read the value from browser using javascript.
first, you have to identify body of the page /html/body
next, you have to create the dummy element on browser by invoking javascript on /html/body element which you have identify in first step
next, you have to add value to that created dummy element
next, you have to identify that created dummy element using blueprism
next, using read stage you can read the value
here is the javascript (which you can invoke ) , which will read the value from element and stores in rtext variable, then create the dummy element on browser , gives ID as Blueprism_JS and add the rtext variable value to that created element,
this element we can identify in application modeller and read the value using read stage.
function getValuefromElement(){
var rtext = document.querySelector("#brf").value;
var elementexists = document.getElementById("Blueprism_JS");
if (elementexists==null){
const mylabel = document.createElement("label");
mylabel.setAttribute("id","Blueprism_JS");
mylabel.innerHTML = rtext;
document.body.appendChild(mylabel);
}
}