Jump to content

Troubles selection option in combobox element


Recommended Posts

Im having troubles selecting a list item in a combobox item on a webpage.

Here is the code for the combobox:

<div id="_ctl0_phMain_cbFilterValues_ob_CbocbFilterValuesMainContainer" class="ob_iCboITCN" style="width:150px;"><div><div class="ob_iCboTL"></div><div class="ob_iCboTR"></div><div class="ob_iCboTC"><div><input name="_ctl0:phMain:cbFilterValues:ob_CbocbFilterValuesTB" type="text" value="-Choose Filter-" id="_ctl0_phMain_cbFilterValues_ob_CbocbFilterValuesTB" class="ob_iCboIE ob_iCboIE_ET" autocomplete="off" /></div><input name="_ctl0:phMain:cbFilterValues:ob_CbocbFilterValuesSIS" type="hidden" id="_ctl0_phMain_cbFilterValues_ob_CbocbFilterValuesSIS" value="-1" /></div></div><div id="_ctl0_phMain_cbFilterValues_ob_CbocbFilterValuesItemsContainer" class="ob_iCboIC" style="width:350px;display:none;"><div class="ob_iCboICH"><div class="ob_iCboICHCL"></div><div class="ob_iCboICHCM"></div><div class="ob_iCboICHCR"></div></div><div class="ob_iCboICB"><div class="ob_iCboICBL"><div class="ob_iCboICBLI"></div></div><ul class="ob_iCboICBC" style="min-height:;"><li><b>False</b><i>False</i></li><li><b>True</b><i>True</i></li></ul><div class="ob_iCboICBR"><div class="ob_iCboICBRI"></div></div></div><div class="ob_iCboICF"><div class="ob_iCboICFCL"></div><div class="ob_iCboICFCM"></div><div class="ob_iCboICFCR"></div></div></div><input name="_ctl0:phMain:cbFilterValues:_ctl0:phMain:cbFilterValues" type="hidden" id="_ctl0_phMain_cbFilterValues__ctl0_phMain_cbFilterValues" /><div class="ob_iCallbackScript" style="display:none;"></div></div>

Ive tried a _IE optionselect call, a checkbox call. Those send a invalid object type error. Getting and sending the value produces no change in it.

Ive tried this as well:

$jcode = "var secondCombo = document.getElementById ( " & Chr(34) & "_ctl0:phMain:cbFilterValues:ob_CbocbFilterValuesTB" & Chr(34) & " ); secondCombo.value = " & Chr(34) & "True" & Chr(34) & ";"

$oIEDoc = _IEDocGetObj( $oIE ) ;Get ourself as a object
$oIEDoc.document.parentwindow.execScript( $jcode )

To execute a javascript based value change. This did not work as well.

 

Any suggestions thus far? There is two filter boxes, the first one changed with this code:

$filter = _IEGetObjByName( $oIE, "_ctl0:phMain:ddlFilterBy" ) ;Get filter object
_IEFormElementOptionSelect( $filter, 9, 1, "byValue" )  ;Select option 1
sleep( 1000 )

However the second one does not (with similar code).

Link to comment
Share on other sites

function initOboutComboBox__cbFilterValues(attempts){ if(typeof(oboutComboBoxJSLoaded) == "undefined" || typeof(Obout.ComboBox) == "undefined") {if(attempts<30){window.setTimeout("initOboutComboBox__cbFilterValues(" + (attempts+1) + ")", 500);}else{alert("There was a problem referencing obout ComboBox javascript files.  Please contact support@obout.com for support.");}return;}try{cbFilterValues = new Obout.ComboBox("_ctl0:phMain:cbFilterValues","cbFilterValues","_ctl0_phMain_cbFilterValues_ob_CbocbFilterValuesMainContainer","_ctl0_phMain_cbFilterValues_ob_CbocbFilterValuesItemsContainer","_ctl0_phMain_cbFilterValues_ob_CbocbFilterValuesTB","_ctl0_phMain_cbFilterValues__ctl0_phMain_cbFilterValues","_ctl0_phMain_cbFilterValues_ob_CbocbFilterValuesSIS",-1,"150px","","350px",false,false,{},true,true,function() {__doPostBack('_ctl0$phMain$cbFilterValues$_ctl0$phMain$cbFilterValues','_ctl0:phMain:cbFilterValues:_ctl0:phMain:cbFilterValues')},{'N': 'ob_iCboITCN','O': 'ob_iCboITCO','AC': 'ob_iCboITCAC','AO': 'ob_iCboITCAO','D': 'ob_iCboITCD','IE': 'ob_iCboIE','IE_ET': 'ob_iCboIE_ET','IE_WI': 'ob_iCboIE_WI'},false,false,false,"-Choose Filter-","",false,false,0,1,false,",",true,false,[],false,"",false);return cbFilterValues;}catch(e){alert("There was an error initializing obout ComboBox with ID cbFilterValues.\n\n" + e.message + "\n\nPlease contact support@obout.com for help.");}} initOboutComboBox__cbFilterValues(0);

I believe this to be the code creating it.

Its a fancy combobox that im unable to manipulate in any way. The filter option I need is just true or false out of it but ive been unsuccessful in anyway to manipulate this.

Link to comment
Share on other sites

Don't worry about the code populating the list...you are only going to be selecting what is created in the html. 

Of the html you provided, there is no object with name="_ctl0:phMain:ddlFilterBy"

Also, you seem to be selecting by index, but you specified that you are search mode = "byValue".

I've automated <ul><li> lists selections by finding my <li> object, and using _ieaction($oli,"click")

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

I see the mistake there, I was actually referencing a working automated code (worked by still fixed it to be byindex, thanks).

Here is the list with html

<ul class="ob_iCboICBC" style="min-height:;"><li><b>False</b><i>False</i></li><li><b>True</b><i>True</i></li></ul>

Im trying to select any of those elements. Now that first html dump in the first post was all the code (when using inspect element) for it. Here is the same code when I select false and inspect it

<div id="_ctl0_phMain_cbFilterValues_ob_CbocbFilterValuesMainContainer" class="ob_iCboITCN" style="width:150px;"><div><div class="ob_iCboTL"></div><div class="ob_iCboTR"></div><div class="ob_iCboTC"><div><input name="_ctl0:phMain:cbFilterValues:ob_CbocbFilterValuesTB" type="text" value="False" id="_ctl0_phMain_cbFilterValues_ob_CbocbFilterValuesTB" class="ob_iCboIE" autocomplete="off" /></div><input name="_ctl0:phMain:cbFilterValues:ob_CbocbFilterValuesSIS" type="hidden" id="_ctl0_phMain_cbFilterValues_ob_CbocbFilterValuesSIS" value="0" /></div></div><div id="_ctl0_phMain_cbFilterValues_ob_CbocbFilterValuesItemsContainer" class="ob_iCboIC" style="width:350px;display:none;"><div class="ob_iCboICH"><div class="ob_iCboICHCL"></div><div class="ob_iCboICHCM"></div><div class="ob_iCboICHCR"></div></div><div class="ob_iCboICB"><div class="ob_iCboICBL"><div class="ob_iCboICBLI"></div></div><ul class="ob_iCboICBC" style="min-height:;"><li><b>False</b><i>False</i></li><li><b>True</b><i>True</i></li></ul><div class="ob_iCboICBR"><div class="ob_iCboICBRI"></div></div></div><div class="ob_iCboICF"><div class="ob_iCboICFCL"></div><div class="ob_iCboICFCM"></div><div class="ob_iCboICFCR"></div></div></div><input name="_ctl0:phMain:cbFilterValues:_ctl0:phMain:cbFilterValues" type="hidden" id="_ctl0_phMain_cbFilterValues__ctl0_phMain_cbFilterValues" value="False" /><div class="ob_iCallbackScript" style="display:none;"></div></div>

So using that ive tried to set the value for everything in there, however it does not appropriately select them. Also when trying to do a selectoption call, it gives me invalid object (on everything in that code).

Where do I go from here or what else can I show/list to help?

Link to comment
Share on other sites

What's the scenario...you fill in the input, and the list appears?

I'd use my signature to grab, and then click the object:

$xPath = "//ul[@class='ob_iCboICBC']/li[contains(.,'False')]"

Signature returns an array of matching objects...then use _IEAction(,"click")...the default loop until find is 2 seconds, you can adjust that as required.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...