# Select all HTML \<select\> \<option\> values

**URL:** <https://community.automationedge.com/t/select-all-html-select-option-values/13817>\
**Category:** Process Studio\
**Created:** [October 31, 2024, 9:00pm UTC](https://community.automationedge.com/t/select-all-html-select-option-values/13817 "2024-10-31T21:00:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wllmdjngh](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.automationedge.com/wllmdjngh/32/952_2.png) [@wllmdjngh](https://community.automationedge.com/u/wllmdjngh)\
**Post date:** [October 31, 2024, 9:00pm UTC](https://community.automationedge.com/t/select-all-html-select-option-values/13817/1 "2024-10-31T21:00:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JohnCosta](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@JohnCosta](https://community.automationedge.com/u/JohnCosta)\
**Post date:** [November 5, 2024, 7:04pm UTC](https://community.automationedge.com/t/select-all-html-select-option-values/13817/2 "2024-11-05T19:04:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wllmdjngh](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.automationedge.com/wllmdjngh/32/952_2.png) [@wllmdjngh](https://community.automationedge.com/u/wllmdjngh)\
**Post date:** [November 5, 2024, 8:23pm UTC](https://community.automationedge.com/t/select-all-html-select-option-values/13817/3 "2024-11-05T20:23:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JohnCosta](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@JohnCosta](https://community.automationedge.com/u/JohnCosta)\
**Post date:** [November 5, 2024, 8:58pm UTC](https://community.automationedge.com/t/select-all-html-select-option-values/13817/4 "2024-11-05T20:58:01Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![wllmdjngh](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.automationedge.com/wllmdjngh/32/952_2.png) [@wllmdjngh](https://community.automationedge.com/u/wllmdjngh)\
**Post date:** [November 5, 2024, 9:35pm UTC](https://community.automationedge.com/t/select-all-html-select-option-values/13817/5 "2024-11-05T21:35:49Z")

</div>

Thanks John.  
Appreciate your input.  
Regards.
