Jump to content
Sign in to follow this  
dar100111

3 buttons on webpage in frame with same tag name

Recommended Posts

dar100111

Hey All!

I think there might be a way to click on the right one by index for my $submit button.

Has anyone ever tried this or know how I might be able to pull this off?

It's clicking on the first one it comes too and I need the 3rd.

Script below and thank you in advance!

#include <IE.au3>
#include <Excel.au3>
#include <Array.au3>
$counter = 1
$oIEb = _IECreate("http://www.ssui.com/inquiry_v2.html", 0, 1)
$oFrame = _IEFrameGetObjByName($oIEb, "body")
$Letter = _IEGetObjByName($oFrame, "LETTER")
$minquiryfield = _IEGetObjByName($oFrame, "multiple_list")
$submitbutton = _IEGetObjByName($oFrame, "CFBQCOMMAND")
_IEFormElementSetValue($Letter, "s")
_IEFormElementSetValue($minquiryfield, "E052809926")
_IEAction($submitbutton, "click")
_IELoadWait($oIEb)
_IEAction($oIEb, "back")

Share this post


Link to post
Share on other sites
Wruck

The key to solving this one is in the source of the webpage. You want to submit the correct value to identify the button.

<!--Button 1:--><INPUT type="submit" value="Submit/Single" name="CFBQCOMMAND">
<!--Button 2:--><INPUT type="submit" value="Submit/Multiple" name="CFBQCOMMAND">
<!--Button 3:--><INPUT type="submit" value="Submit/MultiList" name="CFBQCOMMAND">

Perhaps add another _IEFormElementSetValue() into your code? Something like this?

#include <IE.au3>
#include <Excel.au3>
#include <Array.au3>
$counter = 1
$oIEb = _IECreate("http://www.ssui.com/inquiry_v2.html", 0, 1)
$oFrame = _IEFrameGetObjByName($oIEb, "body")
$Letter = _IEGetObjByName($oFrame, "LETTER")
$minquiryfield = _IEGetObjByName($oFrame, "multiple_list")
$submitbutton = _IEGetObjByName($oFrame, "CFBQCOMMAND")
_IEFormElementSetValue($Letter, "s")
_IEFormElementSetValue($minquiryfield, "E052809926")
_IEFormElementSetValue($submitbutton, "Submit/MultiList")
_IEAction($submitbutton, "click")
_IELoadWait($oIEb)
_IEAction($oIEb, "back")
Edited by Wruck

Share this post


Link to post
Share on other sites
dar100111

Hey Wruck!

Thanks man that worked great.  A bit new to HTML and coding but that does make a lot of sense.

Appreciate the help sir!

Share this post


Link to post
Share on other sites
Wruck

Anytime! Just glad I could help out.

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  

×