cancel
Showing results for 
Search instead for 
Did you mean: 

extract text by google chrome element using javascript

TiagoFreitas
Level 2
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').innerText
36075.pngI need to colect this text and use in object on blueprism

1 REPLY 1

naveed_raza
Level 7

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);

}
}