Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8156115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:51:20+00:00 2026-06-06T16:51:20+00:00

I have seen lots of questions and solutions on File upload using Selenium WebDriver

  • 0

I have seen lots of questions and solutions on File upload using Selenium WebDriver on Stack Overflow. But none of them are working for following scenario.

Someone has given a solution as following

// assuming driver is a healthy WebDriver instance
WebElement fileInput = driver.findElement(By.name("uploadfile"));
fileInput.sendKeys("C:/path/to/file.jpg");

But still I can’t find window handle. How can I work on that?

Screenshot

I am looking for a solution for the scenario above.

Please check this on any of the following websites.

http://www.uploadify.com/demos/
http://www.zamzar.com/
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T16:51:22+00:00Added an answer on June 6, 2026 at 4:51 pm
    // assuming driver is a healthy WebDriver instance
    WebElement fileInput = driver.findElement(By.name("uploadfile"));
    fileInput.sendKeys("C:/path/to/file.jpg");
    

    Hey, that’s mine from somewhere :).


    In case of the Zamzar web, it should work perfectly. You don’t click the element. You just type the path into it. To be concrete, this should be absolutely ok:

    driver.findElement(By.id("inputFile")).sendKeys("C:/path/to/file.jpg");
    

    In the case of the Uploadify web, you’re in a pickle, since the upload thing is no input, but a Flash object. There’s no API for WebDriver that would allow you to work with browser dialogs (or Flash objects).

    So after you click the Flash element, there’ll be a window popping up that you’ll have no control over. In the browsers and operating systems I know, you can pretty much assume that after the window has been opened, the cursor is in the File name input. Please, make sure this assumption is true in your case, too.

    If not, you could try to jump to it by pressing Alt + N, at least on Windows…

    If yes, you can "blindly" type the path into it using the Robot class. In your case, that would be something in the way of:

    driver.findElement(By.id("SWFUpload_0")).click();
    Robot r = new Robot();
    r.keyPress(KeyEvent.VK_C);        // C
    r.keyRelease(KeyEvent.VK_C);
    r.keyPress(KeyEvent.VK_COLON);    // : (colon)
    r.keyRelease(KeyEvent.VK_COLON);
    r.keyPress(KeyEvent.VK_SLASH);    // / (slash)
    r.keyRelease(KeyEvent.VK_SLASH);
    // etc. for the whole file path
    
    r.keyPress(KeyEvent.VK_ENTER);    // confirm by pressing Enter in the end
    r.keyRelease(KeyEvent.VK_ENTER);
    

    It sucks, but it should work. Note that you might need these: How can I make Robot type a `:`? and Convert String to KeyEvents (plus there is the new and shiny KeyEvent#getExtendedKeyCodeForChar() which does similar work, but is available only from JDK7).


    For Flash, the only alternative I know (from this discussion) is to use the dark technique:

    First, you modify the source code of you the flash application, exposing
    internal methods using the ActionScript’s ExternalInterface API.
    Once exposed, these methods will be callable by JavaScript in the browser.

    Second, now that JavaScript can call internal methods in your flash app,
    you use WebDriver to make a JavaScript call in the web page, which will
    then call into your flash app.

    This technique is explained further in the docs of the flash-selenium project.
    (http://code.google.com/p/flash-selenium/), but the idea behind the technique
    applies just as well to WebDriver.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've seen lots of posts on SE relating to this, but none have answered
I have seen lots of similar questions but nothing is working for me. I
I have seen lots of similar questions here but nothing that quite fits my
I've seen lots of questions and solutions to problems like this but nothing has
I have seen lots of questions recently about WPF... What is it? What does
I've seen lots of articles and questions about mysqli, and all of them claim
I have seen lots of class names containg word 'Nugget' in one css file.
Have seen some similar questions: What is the difference between a JavaBean and a
I have seen this question about deploying to WebSphere using the WAS ant tasks.
I have seen two commonly used techniques for adding the directory of the file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.