Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.5k views
in Technique[技术] by (71.8m points)

python - "Message: stale element reference: stale element not found" when trying to get the element using global method define in Javascript

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...