Jump to content

Helping clicking an IE object


Recommended Posts

Hello,

I am sorry for this stupid question, but I have been trying google and do this all day without any progress. I am trying to write an script that can upload a file to mediafire. I am able to log in to mediafire now; however,I need to click on a javascript menu to get to the upload page. I am stuck at this step because I do not know how to get the item ID and how to refer to it.

When I use google chrome to inspect the item, I got this.

'>#<div class="dropdown_container" id="upload_to_current_folder"> <a href="javascript:void(0);" class="folder_mainaction grey_plastic" onclick="Mj(eL);return false;"> <img src="http://cdn.mediafire.com/images/icons/arrow_up_green.png" alt="Upload to this folder"> <img class="disabled" src="http://cdn.mediafire.com/images/icons/arrow_up_grey.png" alt="Uploads disabled"> Upload <span class="arrow_down"></span> </a> <ul> <li><a href="javascript:void(0);" onclick="Mj(eL);return false;" class="icon_uploadarrow">Upload</a></li> <li><a href="/webupload.php" onclick="if(fu==1){return true;}else{LoadIframeLightbox('/templates/upgrade/webuploader.html',750,430);return false;}" class="icon_webupload">Upload from the web</a></li> </ul> <div class="dropdown_pointer"></div> </div>

Here is the script that I have so far:

#include <IE.au3>

$o_IE = _IECreate ()
_IENavigate ($o_IE, "http://www.mediafire.com/")
_IELinkClickByText ($o_IE, "login")


$HWND = _IEPropertyGet($o_IE, "hwnd") ; Window handling command
WinSetState($HWND, "", @SW_MAXIMIZE) ; Maximize the IE window


; get pointers to the login form and username and password fields

$o_form = _IEFormGetObjByName($o_IE, "form_login1")
$o_login = _IEFormElementGetObjByName($o_form, "login_email")
$o_password = _IEFormElementGetObjByName($o_form, "login_pass")

; Set field values and submit the form
_IEFormElementSetValue($o_login, "hoaminh@yahoo.com")
_IEFormElementSetValue($o_password, "123456789")
_IEFormSubmit($o_form)

Currently, I don't know what should I do to get the upload page pop it. I would appreciate any suggestions.

Thank you.

post-66477-0-67908000-1312360430_thumb.p

Link to comment
Share on other sites

There are at least 3 links and a bunch of images and DIVs in the HTML source that you posted. I'm not familiar with the DOM inspector in Chrome, but you should be able to narrow the source down a whole lot better than that (you certainly can with DebugBar).

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

There are at least 3 links and a bunch of images and DIVs in the HTML source that you posted. I'm not familiar with the DOM inspector in Chrome, but you should be able to narrow the source down a whole lot better than that (you certainly can with DebugBar).

Dale

My solution works fine ( on IE8 )

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

@wakilon: your suggestion work. Thanks. =)

When I click the upload button, there is upload container pop up. Currently, I am trying to click on that container. I tried to use _IEGetObjByName, and _IEAction but it's not working right now. Below is the code that I have.

html code:

<div id="MediaFireStep4Popup_0" style="position: fixed; display: inline; z-index: 1006; top: 253px; left: 492px;">

<div id="MediaFireStep4InnerPopup_0">

<div id="step4_info_popup_inner_0" class="uploader_selectfiles">

Autoit

$oFrame = _IEGetObjByName($o_IE, "step4_info_popup_inner_0") 
_IEAction($oFrame, "click") 
_IELoadWait

The whole auto script from the begining

#include <IE.au3>

$o_IE = _IECreate ()
_IENavigate ($o_IE, "http://www.mediafire.com/")
_IELinkClickByText ($o_IE, "login")


$HWND = _IEPropertyGet($o_IE, "hwnd") ; Window handling command
WinSetState($HWND, "", @SW_MAXIMIZE) ; Maximize the IE window

; get pointers to the login form and username and password fields

$o_form = _IEFormGetObjByName($o_IE, "form_login1")
$o_login = _IEFormElementGetObjByName($o_form, "login_email")
$o_password = _IEFormElementGetObjByName($o_form, "login_pass")

; Set field values and submit the form
_IEFormElementSetValue($o_login, "hoaminh@yahoo.com")
_IEFormElementSetValue($o_password, "123456789")
_IEFormSubmit($o_form)
 sleep (10000)
;_IEGetObjByName ( $o_IE, "upload_to_current_folder")
_IELinkClickByText ( $o_IE, "Upload" )

$oFrame = _IEGetObjByName($o_IE, "step4_info_popup_inner_0")
_IEAction($oFrame, "click")
_IELoadWait

This is the screenshot of firebug for this windows

http://imageshack.us/photo/my-images/838/unledrnl.png

Edited by chipmonkboy
Link to comment
Share on other sites

So, if it is a flash button, there is no way to click it (beside using coord method). Is that correct? Because after this step, I will have to click the browse button. Thanks a lot for your help.

Yes it's correct !

I have tried since yesterday to find a way by curl, but unsucessfully.

Look at my signature for another Uploader.Posted Image

Edit : An other uploader who support mediafire.

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Yes it's correct !

I have tried since yesterday to find a way by curl, but unsucessfully.

Look at my signature for another Uploader.Posted Image

Edit : An other uploader who support mediafire.

Thanks a lot. =) After I got your message yesterday. I started to think about dropbox. I can copy my file and put them in the dropbox now. It's much easier to upload files to website. However, I'll try to write one using the website that you suggest for practicing.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...