This is the code on .ts file export class UploadController { readonly fileSelectorOverlayRoot = document.createElement('div'); readonly fileSelectorOverlayTarget = document.createElement('div');
// Marked public solely for the purpose of testing. Do not access directly. readonly
fileSelectorOverlay: FileSelectorOverlay;
// File selector input is placed as a sibling to provided target, so target
// requires a parent element for the input to be reachable.
this.fileSelectorOverlayRoot.appendChild(this.fileSelectorOverlayTarget);
this.fileSelectorOverlay = new FileSelectorOverlay(this.fileSelectorOverlayTarget,
FileSelectorOverlay.SelectorType.MULTIPLE_FILE_SELECTION, ACCEPTED_TYPES as string[]);
this.fileSelectorOverlay.listen (FileSelectorOverlay.EventType.SELECT, (e:
FileSelectEvent) => { this.handleFileSelect(e); });
goog.exportSymbol(
'saglobal.getFileUploadInput', () => this.getFileUploadInput());
}
/**Returns the input element that triggers the file upload dialog. Exported globally for usage in web driver tests. */
private getFileUploadInput(): HTMLInputElement|undefined { return this.fileSelectorOverlayTarget.parentNode?.querySelector('input') || undefined; } Webdriver code
return_value = driver.execute_script("return saglobal.getFileUploadInput()") Error Message: stale element reference: stale element not found
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…