I am using karate framework and I want to use js function in it. Let me explain in detail
I have a requirement where in I need to fetch the id value which is dynamic inside an iframe. So I want to use getElementByTagName('iframe')
function but it is not working. It says ReferenceError: "document" is not defined'
Can someone let me know what all libraries or plugins or dependencies should be added to make this work?
* def elementId =
"""
function()
{
var list = document.getElementsByTagName('iframe');
var results = [];
for (var i = 0; i < list.length; i++) {
var id = list[i].id;
if (id && id.search(/flex-microform-/) != -1) {
return(id);
}
}
return(null);
}
"""
* def temp = call elementId
* print temp