Support Portal

for ProcessRobot and WinAutomation

Start a new topic

Set value JavaScript Dropdown List

 How can I set value for JavaScript Dropdown List?

https://www.syncfusion.com/javascript-ui-controls/dropdown-list

I already try more ways but it still have some error . Please help !


ADMIN

Hello,


Please note some tips for cases like this:

1)In case the element you want to use is in an iframe, you cannot find the elements directly in that page but you can use the hidden link in the iframe property (src) to go to that web page and continue your process from there. for example in this case: https://ej2.syncfusion.com/products/typescript/dropdownlist/first-sample/

2)The javascript dropdown does not behave as a dropdown list as there are not any listed options.

Also for this example, the element you want to change is the 'Input' element and not the 'Select'

3)You can use the WinAutomationJQuery library to change the value of that element but in order to load this library to the browser you need to use any web action which uses controls.

For example: Use a 'get details of element on web page' to any element in the page, just to load the library, and then us the 'Execute Javascript Function On Web Page' using the following syntax:

function ExecuteScript() 

{

WinAutomationJQuery('#container > span > input').val('Andrew').change();

}

4)Another approach would be to use the 'Click Link' twice, and click one on the expanding arrow on the right, and then click the name you want to select.

Hello , Thanks you for quick reply . My problems is input not appear . This is html code .


<div class="content" winautomationvisibilitylandmark="true">
         
                                    <div class="select2-container crm-select2 crm-chain-select-target crm-form-select required" id="s2id_state_province-Primary" winautomationvisibilitylandmark="true" style="width: 225px;"><a href="javascript:void(0)" class="select2-choice" tabindex="-1" winautomationvisibilitylandmark="true">   <span class="select2-chosen" id="select2-chosen-1" winautomationvisibilitylandmark="true">American Samoa</span><abbr class="select2-search-choice-close" winautomationvisibilitylandmark="false"></abbr>   <span class="select2-arrow" role="presentation" winautomationvisibilitylandmark="true"><b role="presentation" winautomationvisibilitylandmark="true"></b></span></a><label for="s2id_autogen1" class="select2-offscreen" winautomationvisibilitylandmark="true">  State
     *

</label><input class="select2-focusser select2-offscreen" type="text" aria-haspopup="true" role="button" aria-labelledby="select2-chosen-1" id="s2id_autogen1" winautomationvisibilitylandmark="true" winautomationtextboxvalue=""></div><select data-callback="civicrm/ajax/jqState" data-empty-prompt="Choose country first" data-none-prompt="- N/A -" class="crm-select2 crm-chain-select-target crm-form-select required" data-select-prompt="- select -" data-name="state_province-Primary" name="state_province-Primary" id="state_province-Primary" tabindex="-1" title="  State
     *

" winautomationvisibilitylandmark="false" style="display: none;">
    <option value="" winautomationvisibilitylandmark="true">- select -</option>
    <option value="1000" winautomationvisibilitylandmark="false">Alabama</option>
    <option value="1001" winautomationvisibilitylandmark="false">Alaska</option>
    <option value="1052" winautomationvisibilitylandmark="false">American Samoa</option>
    <option value="1002" winautomationvisibilitylandmark="false">Arizona</option>
    <option value="1003" winautomationvisibilitylandmark="false">Arkansas</option>
    <option value="1060" winautomationvisibilitylandmark="false">Armed Forces Americas</option>
    <option value="1059" winautomationvisibilitylandmark="false">Armed Forces Europe</option>
    <option value="1061" winautomationvisibilitylandmark="false">Armed Forces Pacific</option>
    <option value="1004" winautomationvisibilitylandmark="false">California</option>
    <option value="1005" winautomationvisibilitylandmark="false">Colorado</option>
    <option value="1006" winautomationvisibilitylandmark="false">Connecticut</option>
    <option value="1007" winautomationvisibilitylandmark="false">Delaware</option>
    <option value="1050" winautomationvisibilitylandmark="false">District of Columbia</option>
    <option value="1008" winautomationvisibilitylandmark="false">Florida</option>
    <option value="1009" winautomationvisibilitylandmark="false">Georgia</option>
    <option value="1053" winautomationvisibilitylandmark="false">Guam</option>
    <option value="1010" winautomationvisibilitylandmark="false">Hawaii</option>
    <option value="1011" winautomationvisibilitylandmark="false">Idaho</option>
    <option value="1012" winautomationvisibilitylandmark="false">Illinois</option>
    <option value="1013" winautomationvisibilitylandmark="false">Indiana</option>
    <option value="1014" winautomationvisibilitylandmark="false">Iowa</option>
    <option value="1015" winautomationvisibilitylandmark="false">Kansas</option>
    <option value="1016" winautomationvisibilitylandmark="false">Kentucky</option>
    <option value="1017" winautomationvisibilitylandmark="false">Louisiana</option>
    <option value="1018" winautomationvisibilitylandmark="false">Maine</option>
    <option value="1019" winautomationvisibilitylandmark="false">Maryland</option>
    <option value="1020" winautomationvisibilitylandmark="false">Massachusetts</option>
    <option value="1021" winautomationvisibilitylandmark="false">Michigan</option>
    <option value="1022" winautomationvisibilitylandmark="false">Minnesota</option>
    <option value="1023" winautomationvisibilitylandmark="false">Mississippi</option>
    <option value="1024" winautomationvisibilitylandmark="false">Missouri</option>
    <option value="1025" winautomationvisibilitylandmark="false">Montana</option>
    <option value="1026" winautomationvisibilitylandmark="false">Nebraska</option>
    <option value="1027" winautomationvisibilitylandmark="false">Nevada</option>
    <option value="1028" winautomationvisibilitylandmark="false">New Hampshire</option>
    <option value="1029" winautomationvisibilitylandmark="false">New Jersey</option>
    <option value="1030" winautomationvisibilitylandmark="false">New Mexico</option>
    <option value="1031" winautomationvisibilitylandmark="false">New York</option>
    <option value="1032" winautomationvisibilitylandmark="false">North Carolina</option>
    <option value="1033" winautomationvisibilitylandmark="false">North Dakota</option>
    <option value="1055" winautomationvisibilitylandmark="false">Northern Mariana Islands</option>
    <option value="1034" winautomationvisibilitylandmark="false">Ohio</option>
    <option value="1035" winautomationvisibilitylandmark="false">Oklahoma</option>
    <option value="1036" winautomationvisibilitylandmark="false">Oregon</option>
    <option value="1037" winautomationvisibilitylandmark="false">Pennsylvania</option>
    <option value="1056" winautomationvisibilitylandmark="false">Puerto Rico</option>
    <option value="1038" winautomationvisibilitylandmark="false">Rhode Island</option>
    <option value="1039" winautomationvisibilitylandmark="false">South Carolina</option>
    <option value="1040" winautomationvisibilitylandmark="false">South Dakota</option>
    <option value="1041" winautomationvisibilitylandmark="false">Tennessee</option>
    <option value="1042" winautomationvisibilitylandmark="false">Texas</option>
    <option value="1058" winautomationvisibilitylandmark="false">United States Minor Outlying Islands</option>
    <option value="1043" winautomationvisibilitylandmark="false">Utah</option>
    <option value="1044" winautomationvisibilitylandmark="false">Vermont</option>
    <option value="1057" winautomationvisibilitylandmark="false">Virgin Islands</option>
    <option value="1045" winautomationvisibilitylandmark="false">Virginia</option>
    <option value="1046" winautomationvisibilitylandmark="false">Washington</option>
    <option value="1047" winautomationvisibilitylandmark="false">West Virginia</option>
    <option value="1048" winautomationvisibilitylandmark="false">Wisconsin</option>
    <option value="1049" winautomationvisibilitylandmark="false">Wyoming</option>
</select>
                     
                            </div>

Login or Signup to post a comment