File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -47,11 +47,17 @@ export async function getPageSource(this: NovaWindowsDriver): Promise<string> {
4747}
4848
4949export async function getScreenshot ( this : NovaWindowsDriver ) : Promise < string > {
50- // TODO: check if it causes problem if child window is opened
5150 const automationRootId = await this . sendPowerShellCommand ( AutomationElement . automationRoot . buildCommand ( ) ) ;
52- await this . focusElement ( {
53- [ W3C_ELEMENT_KEY ] : automationRootId . trim ( ) ,
54- } satisfies Element ) ;
51+
52+ if ( this . caps . app && this . caps . app . toLowerCase ( ) !== 'root' ) {
53+ try {
54+ await this . focusElement ( {
55+ [ W3C_ELEMENT_KEY ] : automationRootId . trim ( ) ,
56+ } satisfies Element ) ;
57+ } catch {
58+ // noop
59+ }
60+ }
5561
5662 return await this . sendPowerShellCommand ( GET_SCREENSHOT_COMMAND ) ;
5763}
You can’t perform that action at this time.
0 commit comments