Question

15
Replies
4477
Views
Devi Michael (DeviM738)
Mphasis

Mphasis
IN
DeviM738 Member since 2017 18 posts
Mphasis
Posted: August 22, 2017
Last activity: September 15, 2017
Posted: 22 Aug 2017 13:36 EDT
Last activity: 15 Sep 2017 15:20 EDT
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 Support Case Created
Moderation Team has archived post, This thread is closed to future replies. Content and links will no longer be updated. If you have the same/similar Question, please write a new Question.