Jump to content
Hrushi

How to download file using autoit without focus on browser? - (Moved)

Recommended Posts

Hi,

I am downloading the file from IE browser through selenium. I am able to download a file if my focus is on browser. But unable to download if focus is not on browser. Could any one please help me?

 

My script :

Send("!s")
; Wait for 9 seconds
Sleep(9000)
; Press Keyboard ENTER button.
Send("{ENTER}")

 

Called using below instruction:

Runtime.getRuntime().exec("C:\\FilePath\\DownloadFile.exe")

Share this post


Link to post
Share on other sites

if you manually press keys on the keyboard does it send those commands to your currently opened window? or does it send the commands to some other window in the background?


If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
    EndIf

"Yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results

Share this post


Link to post
Share on other sites
54 minutes ago, Hrushi said:

@alienclone if i manually press keys on the keyboard , it will sent the command for currently open window, not on browser.

yes, i was being a smartass, your script is "Send"ing key presses, key presses will always go to the active window, that script will never work on a window that doesnt have focus.

 

if you cant use the InetGet functions i pointed to in my other post, you can use Winactivate to make your browser window active first, then send keys.


If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
    EndIf

"Yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results

Share this post


Link to post
Share on other sites

@alienclone Could you please provide example of InetGet function for download file using autoit without focus on browse?

And i want to download file on headless browser also. So i think 'Winactivate' is not a good solution for that.

Share this post


Link to post
Share on other sites

I want to use it in Selenium script  using java. Could you please help for it? 

Requirement is "In my application , i want to click on Download button to download the file.I don't have any URL except Application URL.

Download.png.5c7ca31b3a06b5edf5276521edd2b747.png 

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...