Jump to content

Select radio button then choose save as to download file


Recommended Posts

Hi Folks,

I'm new to Autoit and am a little confused. I would like to perform the following:

1. Open Internet Explorer Go to a url which includes login information.

2. Enter email address and password.

3. Click submit.

4 A new page loads, I need to click on radio button one of 5 possible.

5. Click on a button that generates a CSV file for me to download. A box appears asking me to open or save. I want to save.

6. Exit (logout) of website and close window.

--------------

Tad more information.

The webpage has three forms on it. I need to access the second form that is using "get".

After server creates csv file, a Save or open box appears on webpage. I would like to then download the file to my C: drive.

I know this sounds simple to you folks but i'm still trying to wrap my coconut around scripting. I've been reading the helpfiles and have gotten this far. I'm a better learner by example.

Any help would be very much appreciated.

Thanks so much.

Here's what I got so far.

----------------------------------------------------------------------------------------------------

#include <IE.au3>
; Create a browser window and navigate to  login page
$oIE = _IECreate()
_IENavigate($oIE, "https://www.website i'm going to ")

; Get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "login")
$o_email = _IEFormElementGetObjByName($o_form, "email")
$o_password = _IEFormElementGetObjByName($o_form, "password")


; Set field values and submit the form
_IEFormElementSetValue($o_email, "emailaddress goes here")
_IEFormElementSetValue($o_password, "password goes here")
_IEFormSubmit($o_form)

;Wait until page loads
sleep(1000)

; Click on radio button labled "None"
$oIE = _IE_Example ("approved")
$oForm = _IEFormGetObjByName ($oIE, "NONE")
_IEFormElementRadioSelect ($oForm, "NONE", "s.due_date", 1, "byValue")
Sleep(500)
_IELoadWait ($oIE)

;Click on "Create CSV" button
$oIE = _IE_Example ("form")
$oSubmit = _IEGetObjByName ($oIE, "Generate CSV")
_IEAction ($oSubmit, "click")
_IELoadWait ($oIE)

;Click on "Click on Save as" button save CSV file to c:\Profle folder

;Close script

Exit
Link to comment
Share on other sites

Hi Folks,

I'm new to Autoit and am a little confused. I would like to perform the following:

1. Open Internet Explorer Go to a url which includes login information.

2. Enter email address and password.

3. Click submit.

4 A new page loads, I need to click on radio button one of 5 possible.

5. Click on a button that generates a CSV file for me to download. A box appears asking me to open or save. I want to save.

6. Exit (logout) of website and close window.

--------------

Tad more information.

The webpage has three forms on it. I need to access the second form that is using "get".

After server creates csv file, a Save or open box appears on webpage. I would like to then download the file to my C: drive.

I know this sounds simple to you folks but i'm still trying to wrap my coconut around scripting. I've been reading the helpfiles and have gotten this far. I'm a better learner by example.

Any help would be very much appreciated.

Thanks so much.

Here's what I got so far.

----------------------------------------------------------------------------------------------------

#include <IE.au3>
; Create a browser window and navigate to  login page
$oIE = _IECreate()
_IENavigate($oIE, "https://www.website i'm going to ")

; Get pointers to the login form and username and password fields
$o_form = _IEFormGetObjByName($oIE, "login")
$o_email = _IEFormElementGetObjByName($o_form, "email")
$o_password = _IEFormElementGetObjByName($o_form, "password")


; Set field values and submit the form
_IEFormElementSetValue($o_email, "emailaddress goes here")
_IEFormElementSetValue($o_password, "password goes here")
_IEFormSubmit($o_form)

;Wait until page loads
sleep(1000)

; Click on radio button labled "None"
$oIE = _IE_Example ("approved")
$oForm = _IEFormGetObjByName ($oIE, "NONE")
_IEFormElementRadioSelect ($oForm, "NONE", "s.due_date", 1, "byValue")
Sleep(500)
_IELoadWait ($oIE)

;Click on "Create CSV" button
$oIE = _IE_Example ("form")
$oSubmit = _IEGetObjByName ($oIE, "Generate CSV")
_IEAction ($oSubmit, "click")
_IELoadWait ($oIE)

;Click on "Click on Save as" button save CSV file to c:\Profle folder

;Close script

Exit
Please add a description of what happens when you run this. How far does it get? What error messages do you get? Does the logon work? Does the radio select work? Does it generate the Open/Save dialog?

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Please add a description of what happens when you run this. How far does it get? What error messages do you get? Does the logon work? Does the radio select work? Does it generate the Open/Save dialog?

:P

HI thank you for replying. I get as far as logging in and going to the webpage I need to access.

From here down is where i'm having issues:

; Click on radio button labled "None"

What I need to do is click on a radio button then push on button to create a csv file.

After that a save message box appears and I would like to save to my c: drive.

Thanks so much for your help.

Link to comment
Share on other sites

HI thank you for replying. I get as far as logging in and going to the webpage I need to access.

From here down is where i'm having issues:

; Click on radio button labled "None"

What I need to do is click on a radio button then push on button to create a csv file.

After that a save message box appears and I would like to save to my c: drive.

Thanks so much for your help.

Erm... are you intentionally using "IE_Example" ???

Also for the Radio button click. I would try using:

"_IEAction($Obj, "Click")"

Make sure you are grabbing the correct object, and that the click really is working =)

#include <IE.au3>

$oIE = _IECreate ("WEBSITEHERE")


Global $Username, $oForm
$oForms = _IEFormGetCollection ($oIE)
$iNumForms = @extended
For $A = 0 to $iNumForms - 1
    
    $oForm = _IEFormGetCollection ($oIE, $A)
    $ocollection = _IEFormElementGetCollection ($oForm)
    $Elecount = @extended
    
    For $I = 0 to $Elecount - 1
        $Username = _IEFormElementGetCollection ($oForm, $I)
        MsgBox(0, "Element: ", $A & " " & $I & ") " & $Username.name)
        
    Next
    

Next
Link to comment
Share on other sites

Erm... are you intentionally using "IE_Example" ???

Also for the Radio button click. I would try using:

"_IEAction($Obj, "Click")"

Make sure you are grabbing the correct object, and that the click really is working =)

#include <IE.au3>

$oIE = _IECreate ("WEBSITEHERE")


Global $Username, $oForm
$oForms = _IEFormGetCollection ($oIE)
$iNumForms = @extended
For $A = 0 to $iNumForms - 1
    
    $oForm = _IEFormGetCollection ($oIE, $A)
    $ocollection = _IEFormElementGetCollection ($oForm)
    $Elecount = @extended
    
    For $I = 0 to $Elecount - 1
        $Username = _IEFormElementGetCollection ($oForm, $I)
        MsgBox(0, "Element: ", $A & " " & $I & ") " & $Username.name)
        
    Next
    

Next
I thought uisng IE_Example was the proper way. I've looked a simular scripts and thought this was the way to go. I see tons of stuff for windows gui regarding radio buttons. not alot for ie webstuff.

I've been reading through this board as well as the ie.au3 help stuff but being thick it doesn't set in right away.

I'm going to give your sample code a try.

thanks,

Link to comment
Share on other sites

I thought uisng IE_Example was the proper way. I've looked a simular scripts and thought this was the way to go. I see tons of stuff for windows gui regarding radio buttons. not alot for ie webstuff.

I've been reading through this board as well as the ie.au3 help stuff but being thick it doesn't set in right away.

I'm going to give your sample code a try.

thanks,

I used the code and identified the objects on the page. Updated my code but it still doesnt select the radio. I guess a bit more reading through the help files. The only problem is putting the syntax from the help file into correct format. I have a bit of a hardtime still learning.

Thanks,

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...