blkshadow82 Posted November 4, 2014 Posted November 4, 2014 (edited) Website that I have about 100 programs wrapped around just updated their site code. I have the majority figured out but there is this drop down option select that has a data-bind. I think my problem will be solved with some sort of fireevent. But I cannot figure which one. It could also be how I am selecting the options as well. Here is the code that I have(I got desperate and just loaded up a bunch of fireevents and none of them fixed my issue. I left them in just to show which ones I tried so far) HTML <select style="height: 31px;" id="QuickSearch_CountyId" class="text-box single-line county-selector" name="QuickSearch.CountyId" data-bind="options: shell.lookups().counties, optionsText: 'description', optionsValue: 'id', value: searchVm.crits.co3"><option value="XCA">California</option><option value="ALA">Alameda, CA</option><option value="ALP">Alpine, CA</option><option value="AMA">Amador, CA</option><option value="BUT">Butte, CA</option><option value="CAL">Calaveras, CA</option><option value="COL">Colusa, CA</option><option value="CCX">Contra Costa, CA</option><option value="DNX">Del Norte, CA</option><option value="EDX">El Dorado, CA</option><option value="FRE">Fresno, CA</option><option value="GLE">Glenn, CA</option><option value="HUM">Humboldt, CA</option><option value="IMP">Imperial, CA</option><option value="INY">Inyo, CA</option><option value="KER">Kern, CA</option><option value="KIN">Kings, CA</option><option value="LAK">Lake, CA</option><option value="LAS">Lassen, CA</option><option value="LAX">Los Angeles, CA</option><option value="MAD">Madera, CA</option><option value="MRN">Marin, CA</option><option value="MPA">Mariposa, CA</option><option value="MEN">Mendocino, CA</option><option value="MER">Merced, CA</option><option value="MOD">Modoc, CA</option><option value="MNO">Mono, CA</option><option value="MON">Monterey, CA</option><option value="NAP">Napa, CA</option><option value="NEV">Nevada, CA</option><option value="ORG">Orange, CA</option><option value="PLA">Placer, CA</option><option value="PLU">Plumas, CA</option><option value="RIV">Riverside, CA</option><option value="SAC">Sacramento, CA</option><option value="SBT">San Benito, CA</option><option value="SBD">San Bernardino, CA</option><option value="SDX">San Diego, CA</option><option value="SFX">San Francisco, CA</option><option value="SJX">San Joaquin, CA</option><option value="SLO">San Luis Obispo, CA</option><option value="SMX">San Mateo, CA</option><option value="SBX">Santa Barbara, CA</option><option value="SCL">Santa Clara, CA</option><option value="SCR">Santa Cruz, CA</option><option value="SHA">Shasta, CA</option><option value="SIE">Sierra, CA</option><option value="SIS">Siskiyou, CA</option><option value="SOL">Solano, CA</option><option value="SON">Sonoma, CA</option><option value="STA">Stanislaus, CA</option><option value="SUT">Sutter, CA</option><option value="TEH">Tehama, CA</option><option value="TRI">Trinity, CA</option><option value="TUL">Tulare, CA</option><option value="TUO">Tuolumne, CA</option><option value="VEN">Ventura, CA</option><option value="YOL">Yolo, CA</option><option value="YUB">Yuba, CA</option></select SECTION OF MY CODE Do $oSelect = _IEGetObjById($oIE,"QuickSearch_CountyId") until isobj($oSelect) _IEAction ($oSelect, "focus") _IEAction ($oSelect, "click") _IEAction ($oSelect, "enable") _IEAction ($oSelect, "click") _IEAction ($oSelect, "enable") $oSelect.fireevent("onkeypress") $oSelect.fireevent("onkeydown") $oSelect.fireevent("onkeyup") $oSelect.fireevent("onchange") $oSelect.fireevent("oninput") $oSelect.fireevent("onclick") $oSelect.fireevent("onmousedown") $oSelect.fireevent("onmouseup") $oSelect.fireevent("ondblclick") $oSelect.fireevent("onblur") $oSelect.fireevent("onsubmit") $oSelect.fireevent("onpropertychange") $oSelect.fireevent("onselect") $oSelect.fireevent("onfocusin") $oSelect.fireevent("onfocusout") _IEAction ($oSelect, "blur") _IEAction ($oSelect, "focus") #Region ### Select County on PQ if $sCountyValue = 'California' then _IEFormElementOptionSelect ($oSelect, 'XCA', 1, 'byValue',0) elseif $sCountyValue = 'Alameda' then _IEFormElementOptionSelect ($oSelect, 'ALA', 1, 'byValue') elseif $sCountyValue = 'Alpine' then _IEFormElementOptionSelect ($oSelect, 'ALP', 1, 'byValue') elseif $sCountyValue = 'Amador' then _IEFormElementOptionSelect ($oSelect, 'AMA', 1, 'byValue') elseif $sCountyValue = 'Butte' then _IEFormElementOptionSelect ($oSelect, 'BUT', 1, 'byValue') elseif $sCountyValue = 'Calaveras' then _IEFormElementOptionSelect ($oSelect, 'CAL', 1, 'byValue') elseif $sCountyValue = 'Colusa' then _IEFormElementOptionSelect ($oSelect, 'COL', 1, 'byValue') elseif $sCountyValue = 'Contra Costa' then _IEFormElementOptionSelect ($oSelect, 'CCX', 1, 'byValue') elseif $sCountyValue = 'Del Norte' then _IEFormElementOptionSelect ($oSelect, 'DNX', 1, 'byValue') Endif Do $oSelect = _IEGetObjById($oIE,"QuickSearch_CountyId") until isobj($oSelect) _IEAction ($oSelect, "focus") _IEAction ($oSelect, "click") _IEAction ($oSelect, "enable") $oSelect.fireevent("onkeypress") $oSelect.fireevent("onkeydown") $oSelect.fireevent("onkeyup") $oSelect.fireevent("onchange") $oSelect.fireevent("oninput") $oSelect.fireevent("onclick") $oSelect.fireevent("onmousedown") $oSelect.fireevent("onmouseup") $oSelect.fireevent("ondblclick") $oSelect.fireevent("onblur") $oSelect.fireevent("onsubmit") $oSelect.fireevent("onpropertychange") $oSelect.fireevent("onselect") $oSelect.fireevent("onfocusin") $oSelect.fireevent("onfocusout") _IEAction ($oSelect, "blur") _IEAction ($oSelect, "focus") I found this from another post and think it might help me but I am not sure what it means in terms of actual application. .: Just a warning. A SELECT element has one or more OPTION children. It is the Option.Selected property that actually holds the value for the SELECT (think about Multiple Select). The SELECT.VALUE property may or may not work - it is in IE, but is not part of the standard and falls apart when multiple select is used. Since jQuery is apparently in use here, I'd suggest that there may be other events expected in addition to what is called by _IEFormElementOptionSelect (take a look at the source in IE.au3). Dale I did try $oSelect.value = "CCX" in place of _IEFormElementOptionSelect ($oSelect, 'CCX', 1, 'byValue') but that did not work either. The way I have it written shows the value appearing in the box itself but when I try to run the search on their site it returns with no records. If I select a different option with my mouse and change it back to the actual option I want to select, it then returns the value I am seeking. So I know I am connected to the object, just not selecting the value correctly. Any insight would be much appreciated. Edited November 4, 2014 by blkshadow82
Solution blkshadow82 Posted November 5, 2014 Author Solution Posted November 5, 2014 after more extensive searching on the forum, these scripts fixed my issue: $oEvt = $oIE.document.createEvent("HTMLEvents") $oEvt.initEvent("keydown", True, False) $oQuery4.dispatchEvent($oEvt) AND THIS ONE: Func _SilentEvent($o_Object, $o__IE, $__the_event = "click") If NOT IsObj($o__IE) then Return SetError(1) ;disable "IE click" sound Local $sDefault = RegRead("HKEY_CURRENT_USERAppEventsSchemesAppsExplorerNavigating.Current", "") RegWrite("HKEY_CURRENT_USERAppEventsSchemesAppsExplorerNavigating.Current", "", "REG_EXPAND_SZ", "") Local $o_Evt = $o__IE.document.createEvent("HTMLEvents") $o_Evt.initEvent($__the_event, True, False) $o_Object.dispatchEvent($o_Evt) ;re-enable "IE click" sound RegWrite("HKEY_CURRENT_USERAppEventsSchemesAppsExplorerNavigating.Current", "", "REG_EXPAND_SZ", $sDefault) Return 1 EndFunc ;==>_SilentClick
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now