Forum Discussion

Mr_Bro's avatar
Mr_Bro
Champion Level 0
4 years ago
Solved

Exceuting Custom JS

Hi team,

I am trying to write a custom JS to find elements which are inside an iframe parent using xpath, but im facing some problem  at the last line where I am trying to evaluate the xpath within "contentDocument.Script.eval" .

requesting you to please help me know how to fix the same.

 

Code Snippet:

function CustomJStoFindObj(){
  identifier = eval('"//input[@id=\'f2b06437___form_menu_form_name\']"')
  test = 'document.evaluate("' +identifier+'",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue;'
  Log.Message(test.toString());
  temp = test.toString();
  var pageObj = Sys.Browser("chrome").Page("URL")
  var Obj = pageObj.contentDocument.Script.eval(temp)
}

 waiting for your valuable reply.

 

Thanks in Advance 

3 Replies