select a specific combobox option on web form

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
johnsis
Newbie
Posts: 10
Joined: Fri Nov 30, 2007 6:59 pm

select a specific combobox option on web form

Post by johnsis » Fri Nov 30, 2007 7:57 pm

I have a web form that I enter information in all the time. The problem is on the combobox option I alway need to select the 2 option and sometimes depending on when the macro is executed the 1st option is selected but sometimes it has my previous selection. Is there anyway to figure out which one is selected and if it is the first one to select the 2nd option.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Nov 30, 2007 9:30 pm

Left Click on the combo box arrow.

Press HOME
Press DOWN*2
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

johnsis
Newbie
Posts: 10
Joined: Fri Nov 30, 2007 6:59 pm

select a specific combobox option on web form

Post by johnsis » Fri Nov 30, 2007 10:33 pm

That didn't seem to work for me. Maybe I'm getting confused as to what a combo box is. I have 3 options that I can select that will put a dot beside my selected option. When I left click on the one I want and press HOME nothing happens and if I press DOWN twice it just moves to the 3rd option down.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Dec 01, 2007 12:41 am

Aha, you have described a Radio Button Group. That will be tougher.

You may have to experiment with this one.
Try going to the field just previous to the Radio Buttons.
Then PRESS TAB, that may bring you to the first option, or it may bring you the option that is set. If it goes to the first option, then just PRESS RIGHT ARROW to move to the second option, that may set the value, then just PRESS ENTER.

But this may not work, it will be a function of many things out of your control. You may need to press the spacebar to set the value, but if that button is already set, then you will be unsetting it.

So, you may need to do Image recognition. You may need an image for each button, then loop through to find which one is set. Then you can go to the previous button and do the keystrokes as needed based on the results of the image analysis.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Danish_Ken
Junior Coder
Posts: 22
Joined: Mon Sep 12, 2005 1:34 am
Location: Melbourne - Australia

Post by Danish_Ken » Mon Dec 10, 2007 5:55 am

What does one do if it's an actual dropdown list. Such as featured in http://www.whitepages.com.au/wp/index.jsp
Choose a state.

Is there a way to pick a specific option using webrecorder?

Thanks
Macro Scheduler since Version 5.0 - 21/10/1998

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Tue Dec 11, 2007 4:23 am

Looked at that link.

The field for State is a combo box. See my combo box instructions above.
1. Tab into the field for State.

2. Then Home/End to top/bottom, Up/Down*x to move to selection. Can also type the first letter to move to center, then press Up/Down*x.

Example, suppose combo has "Tasmania".
Tab into the State
Press Home
Press Down*2
This results in "New South Wales" as the selection.
Now Press Tab to leave the field.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Danish_Ken
Junior Coder
Posts: 22
Joined: Mon Sep 12, 2005 1:34 am
Location: Melbourne - Australia

Post by Danish_Ken » Tue Dec 11, 2007 4:51 am

Thanks Bob,
but the webpage mentioned was just a sample, as the real one I need to automate is locked down behind a firewall.
The actual webpage has a looong (200+) list of userids in a combo box all starting with D, then some numbers. (don't get me started on bad web design :evil: ) The combo box only allows "type ahead" on the first character.
I'm sure I read some entries somewhere in the discussion forums on how to automate combo boxes, but I can't find the threads.
Macro Scheduler since Version 5.0 - 21/10/1998

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Dec 12, 2007 12:10 am

If you need the second one Iyour original posting), you usually just need to set the focus in the field, press HOME, and press DownArrow 2 times.

How do you do this manually?
Whatever you do manually you can do with the keys in the script.

Experiment with making the selection manually .... how to get to the Home position, or to the end, or to the first letter. Then count the Up//Down arrows to move to the desired selection. Then use all of those keys in the script.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Dec 12, 2007 9:42 am

If you are using WebRecorder you can use the ItemSelected functin to return the index and/or string of the selected item in a SELECT field (drop down).

You can also use FormFill function to set the value of a drop down (SELECT) field either by value or by index.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts