When there's an element you can't directly reference, get the next closest thing above it in hierarchy, then either pull the frame from instance number or loop through and check its contents. For example, lets say the iframe is inside a
<div> tag, which has something searchable (ID, classname, etc.). You can get that with something like
divElement:=document.getElementById("DIV_ID") then you can use
divElement.getElementsByTagName("iframe")[0], assuming this iframe is the first one found from the previous element (change the 0 accordingly; it's a 0-index linear array). Alternatively, you may combine the commands:
iframeElement:=document.getElementById("DIV_ID").getElementsByTagName("iframe")[0] where
iframeElement now contains the document element of the iframe, to which you can perform normal
document methods on, such as
iframeElement.src.
Alternatively, you can omit
[0] or any index number to save the HTML live collection and loop through it like so to check for any identifying information if there are still multiple tags:
Code: Select all
loop % iframeElements.length() { ; syntax may be wrong here; length may or may not be available
if(iframeElements[a_index-1].title="data visualization"){ ; if current-iteration element contains title name
iframeElement:=iframeElements[a_index-1] ; save to var
}
The reason to use a loop count instead of checking inside the array is because attempting to call an element of the array which does not exist will throw an error (could be caught with
try).