1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Automate select file dialog - Webbrowser

Discussion in 'General Programming Chat' started by Kuranyi, Sep 5, 2011.

  1. Kuranyi

    Kuranyi Junior Member

    Joined:
    Dec 21, 2009
    Messages:
    104
    Likes Received:
    51
    Hello,
    I want to automate a website with the webbrowser control(.net) where I have to upload a file. This is the input element where I want to add the path:
    Code:
    <input class="file" id="file" name="file" type="file" />
    SetAttribute or InnerText don't work. I read that this is because of security reasons. After Invoke("click") the default "select file" dialog open. And that stops the whole tool.
    And now I have no idea how to automate this. Of course I can run an other tool which send keys, but that is very bad and awkward. Besides i want to run my tool at the background.

    So do you have an idea? I have already searched a lot..
    Thanks, I will add rep for the solution. :)
    Greetings!

    PS: Yes, because of javascriopt I need to use the webbrowser control and not httprequest.
     
  2. Subsonic

    Subsonic Regular Member

    Joined:
    Mar 17, 2011
    Messages:
    367
    Likes Received:
    333
    Location:
    DNS root zone database
    • Thanks Thanks x 2
    Last edited: Sep 5, 2011
  3. Kuranyi

    Kuranyi Junior Member

    Joined:
    Dec 21, 2009
    Messages:
    104
    Likes Received:
    51
    Many many thanks, bro! The first one is what I was looking for! After hours of working I got a great result.
    Thanks! :)
     
  4. Subsonic

    Subsonic Regular Member

    Joined:
    Mar 17, 2011
    Messages:
    367
    Likes Received:
    333
    Location:
    DNS root zone database
    Hey no problem! I know how it feels like to be stuck in one small thing which just doesn't work! ;)