Question

15
Replies
4307
Views
DeviM738 Member since 2017 18 posts
Mphasis
Posted: 3 years ago
Last activity: 3 years 1 month ago
Closed
Solved

Raising an HTML Event with JavaScript through Pega Robotics

I tried this solution and it works for those objects that have either an object name or object id. But in one of our application there is a text field with neither an object name nor id.

How can I modify the code to work in such a scenario?

I modified the code , by passing the element as the second parameter instead of the element ID.

As the second parameter I am passing the "this" property of the text box in question. But when executing, I am getting a run time error when the automation goes to the invokescript

Also attached is the screen-shot of the automation. Please advise

Code:

------

function os_RaiseEvent(eventname,element)
{
var event;
if(document.createEvent)
{

event = document.createEvent("HTMLEvents");
event.initEvent(eventname, true, false);
if(eventname == "keydown" || eventname == "keyup")
{
event.keyCode = 13;
}

element.dispatchEvent(event);

}
else if(document.createEventObject)
{
event = document.createEventObject();
if(eventname == "keydown" || eventname == "keyup")
{
event.keyCode = 13;
}

element.fireEvent("on" + eventname, event);
}
return true;
}

Robotic Process Automation SR Created
Moderation Team has archived post
Share this page LinkedIn