Finding elements in iFrames is slow
sampacos opened this issue · 1 comments
When testing elements located deep in 2-3 iframes, it can take 1 second + in order for sentinel to find the element. I believe this is due to the excessive looping we do when finding elements. When an element is requested, the call stack is the following:
- go to root frame
- element() [loop for default of 10 seconds]
- findElementInCurrentFrameForDuration() [loop through each selector, search current frame]
- getElementWithWait() [create fluentwait object, using 1 selector query webdriver for element for 100 ms, retrying every 10 ms]
If element is not found in the root frame, we loop through each found frame, repeating (3) and (4). If an element is in the 3rd frame found, we have wasted (200 * number of selectors) milliseconds trying to find an element that isn't in the frames we've been looking in. Additionally, because we reset to the root frame each time we reference a new element, we have to waste that much every time a new element is referenced in sequence that exists in the same frame we were just looking in for the previous element. I think we can make this way faster.