Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Web Page Drop Down Box Selection Issue
#1
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
Code:
Copy      Help
,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
#2
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?
#3
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
#4
Try flag 1, maybe other flags.

a11.CbSelect("Business" 1)
#5
Tried all the flags 1,2,4,8
No Luck.
Best Regards,
Philip
#6
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
Code:
Copy      Help
a11.Select(1)
key V ;;Space should show the list. Or try key AD
key H D(#3) Y ;;Home, Down 3 times, Enter
#7
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
#8
Macro Macro267
Code:
Copy      Help
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
Code:
Copy      Help
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.


Forum Jump:


Users browsing this thread: 1 Guest(s)