Ask a Question

Exceuting Custom JS

SOLVED
Mr_Bro
Frequent Contributor

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 3
sonya_m
SmartBear Alumni (Retired)

Hi @Mr_Bro !

 


Sonya Mihaljova
Community and Education Specialist

Mr_Bro
Frequent Contributor

Hi @sonya_m ,

 

Thank you very much, it helped me a lot to find out the solution.

 

sonya_m
SmartBear Alumni (Retired)

@Mr_Bro You are welcome! I am really glad this was helpful🙂


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: