Jump to content
Sign in to follow this  
Akos

Handle browser dialog window without focus

Recommended Posts

Akos

I have a Selenium WebDriver based script to automate file uploading. It uploads list of files one by one. I use AutoIT script to handle dialog window, file chooser window. Parameter $CmdLine[1]contains the path of actual file.

ControlFocus("Open a file","","Edit1")
ControlSetText("Open a file","","Edit1", $CmdLine[1])
ControlClick("Open a file","","Button1")

I execute it from Java code as following:

Runtime.getRuntime().exec(autoITExecutable);

It opens dialog window, so it can't work without focus on browser window.

Share this post


Link to post
Share on other sites
Akos

Variable autoITExecutable contains path of exe file and parameter value too. My question is, how could I execute test without opening dialog window. I would like to execute it without focus on browser and maybe in headless mode.

Share this post


Link to post
Share on other sites
Danp2

If the goal is to upload files without using the file selection dialog, then I think the solution wouldn't require Autoit and would be dependent on the website involved.

Not sure how you would accomplish this without more details.

Share this post


Link to post
Share on other sites
Akos

What kind of details? I tried to use sendKeys(""); method, but input field doesn't accept file in this way.

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  

×