Can't attach to a Windows App when running browser headless

When dealing with Windows dialogs, e.g. Open (displayed from something like <input type=“file” id=“fileUpload” " accept=".csv">), we normally use the operation “Get Window Names from Open Windows Apps”, and “Attach Windows App”. These make it possible to hook into the Open Dialog and interact with it. However, when running in headless mode, the get window names operation returns an empty value and trying to attach to the Open Dialog using a known window title fails, stating that “Application not found”.
How do we interact with the dialogs when using headless? As an alternative, is there a way to select the file to upload/open using a different operation?

Hi, if you’re running Chrome (or a chromium based broser) with the --headless argument, it doesn’t open those dialogs, so there’s nothing to attach to, although Firefox started with the -headless argument does.
If you need to fill in the upload field you can use the ‘Upload File in Browser’ operation, here’s an example usage.

text.write ( text = 'Hello World' , filePath = 'upload.txt' ) 
web.start ( browser = 'CHROME' , session = 'test' , url = 'https://cgi-lib.berkeley.edu/ex/fup.html' ) 
web.upload ( filePath = 'upload.txt' , target = '//input[@name="upfile"]' ) 
web.click ( target = '//input[@type="submit"]' )
1 Like