Jump to content
Sign in to follow this  
bbk4163

Cant upload files in Chrome

Recommended Posts

bbk4163

I am trying to crate a common exe for IE(Choose File to Upload),Chrome(Open),Firefox (File Upload) browser based file upload using below code. This is working for for IE but not for Chrome and FireFox not sure what is the issue? 

I will be using this .exe in my Robot Framework script. 

   

#include <MsgBoxConstants.au3>
    
    SelectWindowBasedOnTitle()
    
    Func SelectWindowBasedOnTitle()
    
        $winList = WinList()
        $wTitle = CheckWindows($winList)
    
       IF $wTitle == "Choose File to Upload" Then
                IE()
       ElseIf $wTitle == "Open" Then
                Chrome()
       Else
                FireFox()
       EndIf
    EndFunc
    
    
    Func CheckWindows($aArray)
    
        For $i = 1 To Ubound($aArray) - 1
            If WinActive($aArray[$i][1]) Then $wTitle= $aArray[$i][0] ;MsgBox(0, "Window Check", $aArray[$i][0] & " is active.")
        Next
        Return $wTitle
    EndFunc
    
    
    Func Example()
        $wText = WinGetText("[ACTIVE]")
    EndFunc
    
    Func IE()
        ControlFocus("Choose File to Upload","","Edit1")
        ControlSetText("Choose File to Upload","","Edit1",$CmdLine[1])
        ControlClick("Choose File to Upload","","Button1")
    EndFunc
    
    Func Chrome()
        ControlFocus("Open","","Edit1")
        ControlSetText("Open","","Edit1",$CmdLine[1])
        ControlClick("Open","","Button1")
    EndFunc
    
    Func FireFox()
        ControlFocus("File Upload","","Edit1")
        ControlSetText("File Upload","","Edit1",$CmdLine[1])
        ControlClick("File Upload","","Button1")
    EndFunc

This way i am using in my Robot script. Could you please help me understand is there a way to automate in Chrome and Firefox. 
   

    ${FileInfo}     ${CURDIR}\\Xpaths.txt
        ${AutoIT}     ${CURDIR}\\BrowserBasedWindowSelection.exe
        Run Process   ${AutoIT}   ${FileInfo}

Share this post


Link to post
Share on other sites
bbk4163

Looks like posted in wrong group. Is there a way to move this post to AutoIT General support and Help?

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×