Jump to content

Recommended Posts

Posted (edited)

I want wanting to run multiple tests on my company website. Sadly the process I want to automate requires opening a File Explorer to add an attachment. Is there a way in to automate a Chrome opened File Explorer?

(I am using webdriver to automate the other 99% of the process just fine. But when I have it click on attach file and chrome opens a file explorer I do not know how to handle it.) 

Any help would be greatly appreciated. 

Edited by nooneclose
solved
Posted
Posted

@Nine Do I need to send an enter? after sending a path or file name? Or should this work?

If WinActive("[CLASS:DirectUIHWND1]") Then ; Check if File Explorer is currently active.
    ConsoleWrite("WinActive" & @CRLF & "File Explorer is active.")
    Sleep(500)

    ; Send File Path
    ControlSend("[CLASS:ToolbarWindow32]", "", "ToolbarWindow323", $PoAttachPath)
    Sleep(500)

    ; Send File Name
    ControlSend("[CLASS:Edit]", "", "Edit1", $rdArray[$i][7])
    Sleep(500)

    ; Click 'OPEN'
    ControlClick("[CLASS:Button]", "", "Button1")
    Sleep(2500)

EndIf

 

Posted

I don't have Chrome on Win10, but this is working fine with Edge :

Local $PoAttachPath = @ScriptDir
Local $sFileName = "Temp1.au3"

If WinExists("[CLASS:#32770]") Then  ; Check if File Explorer exists
  Local $hWnd = WinActivate("[CLASS:#32770]")
  ConsoleWrite($hWnd & " / File Explorer is NOW active." & @CRLF)
  Sleep(500)

  ; Send File Name
  ConsoleWrite(ControlSetText($hWnd, "", "Edit1", $PoAttachPath & "\" & $sFileName) & @CRLF)
  Sleep(500)

  ; Click 'OPEN'
  ControlClick($hWnd, "", "Button1")
  Sleep(2500)

EndIf

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...