Sign in to follow this  
Followers 0
miragee

Click "button" in order to upload a file

9 posts in this topic

I need to click into a div in order to open a file dialog.

When i browse the page source i see this

<div id="upload_a_file" content_type="files"></div>

But when i see the source using the developer tools i see this

<div id="upload_a_file" content_type="files"><div class="qq-uploader"><div class="qq-upload-drop-area" style="display: none;"><span original-title=""><img src="../fileuploader/add_file.png" alt="" border="0" class="middle" width="16" original-title=""></span></div><div class="qq-upload-button" style="position: relative; overflow: hidden; direction: ltr;"><div>Send File</div><input multiple="multiple" type="file" name="file" style="position: absolute; right: 0px; top: 0px; font-family: Arial; font-size: 118px; margin: 0px; padding: 0px; cursor: pointer; opacity: 0;" class="" original-title=""></div><span class="qq-drop-processing" original-title=""><span original-title="">undefined</span><span class="qq-drop-processing-spinner" original-title=""></span></span><ul class="qq-upload-list"></ul></div></div>

How i could click into "Send File" in order to open the file dialog ?

Atm i've this to click on the submit button

Global $oIE = _IECreate("link", 0,0)
Local $btn_upload = _IEGetObjByName($oIE ,"upload")
_IEAction($btn_upload, "click")

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

<div id="upload_a_file" content_type="files"></div>

That "upload_a_file" is your button then in script you should wrote:  $btn_upload = _IEGetObjByName($oIE ,"upload_a_file")

Global $oIE = _IECreate("link", 0,0)
Local $btn_upload = _IEGetObjByName($oIE ,"upload"); - this "upload" shouldn't be "upload_a_file" ?
_IEAction($btn_upload, "click")
Edited by DocTorCoder

DocTorCoder

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

JohnOne, tried with that but no luck, any ideas ?

DocTorCoder, that's the submit button! I need to find a way to click on that text.

Edited by miragee

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

JohnOne, tried with that but no luck, any ideas ?

DocTorCoder, that's the submit button! I need to find a way to click on that text.

Did you tried this method with httprequest?

And for headers(not so good explained):

A good explanation:

Edited by DocTorCoder

DocTorCoder

Share this post


Link to post
Share on other sites

Basicly i just need it to find the button and click on it, i can put the coordinates there but if i run into another resolution i will get into some problems :/

Share this post


Link to post
Share on other sites

Basicly i just need it to find the button and click on it, i can put the coordinates there but if i run into another resolution i will get into some problems :/

Then you can use pixelsearch after a color? a pixel color from that button?


DocTorCoder

Share this post


Link to post
Share on other sites

Can you explain a little more ?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Can you explain a little more ?

you can use autoit window info to get the positions and pixel color

Capture.png

Then you can wrote something like:

while 1
        Local $aCoord1 = PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 0xD8DDE8)
        If Not @error Then
            MouseClick("", $aCoord1[0], $aCoord1[1],2)
            Sleep(200)
        EndIf
        Sleep(200)
Wend

This will search for pixel color "0xD8DDE8" and return the coord where are found. And you just use those x and y for a mouseclick or control send...etc

Edited by DocTorCoder

DocTorCoder

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  
Followers 0