Posts: 166
Threads: 57
Joined: Aug 2013
Hi Gintaras,
Having trouble selecting a value on a web page dropdown box.
The value gets selected, but the page does not action on the value.
The value needs to correspondingly change a value on another dropdown box.
The webpage executes successfully only if the value is clicked in the first dropdown box.
How can we execute that part in Quick Macro?
Macro
RO Sales VISTA - Current
,else if salesType="f"
,,Acc a11.Find(w3 "COMBOBOX" "" "a:name=contDrpDown" 0x3004 50)
,,a11.CbSelect("Business"); 0.5 ;; This dropdown box needs to be opened and value clicked to be selected.
,,
,,
,,
,,'T;2
,,
,,
,,e45.CbSelect("Fleet of 1-24 vehicles"); 2
Best Regards,
Philip
Posts: 12,092
Threads: 142
Joined: Dec 2002
What web browser?
Did you try CbSelect flags?
Is it possible to select the combo box item manually with the keyboard?
When the combo list is visible, is the item visible without scrolling?
Posts: 166
Threads: 57
Joined: Aug 2013
What web browser? - IE11
Did you try CbSelect flags? - No. I don't know what to change/add.
Is it possible to select the combo box item manually with the keyboard? - Yes. Also possible using mouse click.
When the combo list is visible, is the item visible without scrolling? - Yes.
Best Regards,
Philip
Posts: 12,092
Threads: 142
Joined: Dec 2002
Try flag 1, maybe other flags.
a11.CbSelect("Business" 1)
Posts: 166
Threads: 57
Joined: Aug 2013
Tried all the flags 1,2,4,8
No Luck.
Best Regards,
Philip
Posts: 12,092
Threads: 142
Joined: Dec 2002
Please test this. Here #3 is the number of key Down required in the drop-down list to select the item; if it is known, simply change it in the macro, else I'll create code to find item by its text and calculate the Down key count.
Macro
Macro167
a11.Select(1)
key V ;;Space should show the list. Or try key AD
key H D(#3) Y ;;Home, Down 3 times, Enter
Posts: 166
Threads: 57
Joined: Aug 2013
Thanks Gintaras.
Works perfectly.
However, on a separate note, if you can provide the second solution please, it would be great.
In the future, if the values change position from our client side, atleast the correct option will be selected.
(code to find item by its text and calculate the Down key count)
Regards,
Philip
Best Regards,
Philip
Posts: 12,092
Threads: 142
Joined: Dec 2002
Macro
Macro267
a11.Select(1)
int n=a11.CbIndexOf("Business"); if(n<0) end "combo box item not found"
key V ;;Space should show the list
key H D(#n) Y
Member function
Acc.CbIndexOf
function# $name
;Finds combo box item and returns 0-based index.
;Returns -1 if not found.
;name - item text. Wildcard, case-insensitive.
STRINT si.s=name; si.i=-1
Acc ai.Find(this.a "LISTITEM" "" "" 0x10 0 0 "" &sub.Callback &si)
if(!ai.a) ret -1
ret si.i
#sub Callback
function# Acc&ai level STRINT&r
r.i+1
str s=ai.Name
if(!s.len and r.s.len) s=ai.Value ;;Chrome
ret !matchw(s r.s 1)
err ret 1
Create it with menu File / New / Member Function.