Hi,
I need to select all “option” values from a Combo Box.
Any input how this could be done?
Combobox only has the capability to select one item.
Feedback is much appreciated.
Hi,
I need to select all “option” values from a Combo Box.
Any input how this could be done?
Combobox only has the capability to select one item.
Feedback is much appreciated.
I use JS for custom selection, and the example below selects all options:
var selectElement = document.querySelector(‘select’); // Replace ‘select’ with the correct selector if necessary
for (var option of selectElement.options) {
option.selected = true;
}
You can use the injection step, or you can use AutoIt to insert the code directly into the browser console.
Thanks @JohnCosta .
Implemented this code and works fine.
Thanks for the tip.
Have to figure out on how tu use AutoIt to do the same.
Here is an example with AutoIt. I’m not familiar with this script, but I believe it should work this way.
; Define the title of the browser window
$title = “Page Title”
Local $html_select = “var selectElement = document.querySelector(‘select’);”
; Wait for the window to appear
WinWait($title, “”, 10)
; Get the handle of the browser window
$handle = WinGetHandle($title)
; Activate the browser window using the handle
WinActivate($handle)
Sleep(4000)
; Open Developer Tools
Send(“^+j”) ; Ctrl + Shift + j
Sleep(4000)
; Focus on Console
Send(“^'”)
Sleep(2000)
; Send command select
Send($html_select)
Sleep(500)
Send(“{ENTER}”)
Sleep(2000)
$change_option_line_one = “for (var option of selectElement.options) {”
$change_option_line_two = “option.selected = true;”
$change_option_line_three = “}”
; Send change option
Send($change_option_line_one)
Sleep(500)
Send(“{ENTER}”)
Sleep(500)
Send($change_option_line_two)
Sleep(500)
Send(“{ENTER}”)
Sleep(500)
Send($change_option_line_three)
Sleep(500)
Send(“{ENTER}”)
Sleep(500)
Thanks John.
Appreciate your input.
Regards.
![]() |