What is the best way to select Drop-down item in dojo based HTML in Java for Selenium Web-driver?

Hi all,

I am working on an Auto-select drop-down which internally is not a Select

Currently I am using

then click on simple text-box elsewhere in the screen,It works generally.

But on random occasions its not completely selecting the intended value in drop-down. Kindly advise a best method to select values in this case?
What sort of drop-down is this, as in HTML there’s no SELECT tag?

Note: I have very minimal control on the HTML of the application under test

Many Thanks

Ajax Page Factory type Webdriver code:

advertiser.clear();

advertiser.sendKeys(sAdvertiser,Keys.ARROW_DOWN,Keys.RETURN);

driver.manage().timeouts().implicitlyWait(myUtil.WAIT_TIME, TimeUnit.SECONDS);

additionalArea.click();

subTitlesRequired.clear();

subTitlesRequired.sendKeys(sSubtitles,Keys.ARROW_DOWN,Keys.RETURN);

driver.manage().timeouts().implicitlyWait(myUtil.WAIT_TIME*2, TimeUnit.SECONDS);

additionalArea.click();

if(!brand.isEnabled()){

advertiser.click();

subTitlesRequired.click();

advertiser.click();

advertiser.clear();

advertiser.sendKeys(Keys.ARROW_DOWN,Keys.RETURN);

driver.manage().timeouts().implicitlyWait(myUtil.WAIT_TIME*2, TimeUnit.SECONDS);

additionalArea.click();

}//end if

brand.clear();

brand.sendKeys(sBrand,Keys.ARROW_DOWN,Keys.RETURN,Keys.TAB);

additionalArea.click();

driver.manage().timeouts().implicitlyWait(myUtil.WAIT_TIME*2, TimeUnit.SECONDS);

if(!product.isEnabled()){

advertiser.click();

subTitlesRequired.click();

advertiser.click();

brand.clear();

brand.sendKeys(Keys.RETURN);

driver.manage().timeouts().implicitlyWait(myUtil.WAIT_TIME, TimeUnit.SECONDS);

additionalArea.click();

}//end if

product.click();

product.sendKeys(xmlDataReader.searchElement(“AddInformation”,“Product”),Keys.ARROW_DOWN,Keys.RETURN);

HTML:

<div id=”informationBlock” style=”height: auto;”>
<div widgetid=”ordering_form_addInfo_Form_1″ id=”ordering_form_addInfo_Form_1″ class=”addInformationForm plm ptm” data-role=”resetable” data-dojo-type=”ordering.form.addInfo.Form” data-dojo-props=”item: dojo.getObject(&quot;_refs.0.3&quot;), params: { schemaInstance: dojo.getObject(&quot;_refs.0.4&quot;), schemaName: ‘tv_order_item.market.3′, templateName: ‘ordering.form.add_information_fields_for_each’, viewContext: ‘edit’ }”>
<div data-role=”arppLinkContainer”></div>
<div class=”clearfix pbm schema_field_wrapper” data-role=”schemedContent”><div class=”schemedContent mtxs size1of1″><div class=”clearfix border-bottom mbxs none”>
<div class=”plm pbxs”><h5>Add Information</h5></div>
</div>
<div class=”clearfix mbm”>
<div class=”unit size7of10″>
<div class=”mbm plm mtxs”><div class=”schemaDataField unit size1of2

“><div widgetid=”common_prop_schema_AdCodeField_1″ id=”common_prop_schema_AdCodeField_1″ class=”relative adCodeFieldContainer” data-dojo-type=”common.prop_schema.AdCodeField” data-dojo-props=”controller: dojo.getObject(&quot;_refs.2.0&quot;)”><div class=”schema_field relative” data-schema-path=”tv_order_item.market.3#_cm.common.clockNumber”>
<label>
<div class=”inline-block required_field”>Clock #</div>
<input widgetid=”common_prop_schema_ClockNumberText_1″ placeholder=”” id=”common_prop_schema_ClockNumberText_1″ data-role=”schemaField” name=”_cm.common.clockNumber” value=”” data-dojo-type=”common.prop_schema.ClockNumberText” data-dojo-props=”data:dojo.getObject(&quot;_refs.2.1&quot;),
disabled : false,
required: true,
placeholder: ”” required=”” class=”ui-input” type=”text”><div data-role=”warning” class=”spriteicon i24x24_warning absolute mls hidden”></div>
</label>
</div></div></div><div class=”schemaDataField unit size1of2

“><div class=”schema_field” data-schema-path=”asset_element_project_common.agency.5315acdce4b05c06b581309e#_cm.asset.common.advertiser”>
<label for=”common_prop_schema_FilteringSelect_6″><div class=”required_field”>Advertiser</div></label>
<div widgetid=”common_prop_schema_FilteringSelect_6″ aria-disabled=”false” class=”dijit dijitReset dijitInline dijitLeft dijitTextBox dijitComboBox dijitValidationTextBox dijitTextBoxIncomplete dijitComboBoxIncomplete dijitValidationTextBoxIncomplete dijitIncomplete” id=”widget_common_prop_schema_FilteringSelect_6″ role=”combobox” aria-haspopup=”true” data-dojo-attach-point=”_popupStateNode”><div class=”dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer” data-dojo-attach-point=”_buttonNode” role=”presentation”><input class=”dijitReset dijitInputField dijitArrowButtonInner” value=”▼ ” tabindex=”-1″ readonly=”readonly” role=”button presentation” aria-hidden=”true” type=”text”></div><div class=”dijitReset dijitValidationContainer”><input class=”dijitReset dijitInputField dijitValidationIcon dijitValidationInner” value=”Χ ” tabindex=”-1″ readonly=”readonly” role=”presentation” type=”text”></div><div class=”dijitReset dijitInputField dijitInputContainer”><input aria-invalid=”true” value=”” aria-required=”true” aria-disabled=”false” data-role=”schemaField” id=”common_prop_schema_FilteringSelect_6″ tabindex=”0″ class=”dijitReset dijitInputInner” autocomplete=”off” data-dojo-attach-point=”textbox,focusNode” role=”textbox” type=”text”><input value=”” name=”_cm.asset.common.advertiser” type=”hidden”></div></div>
</div></div><div class=”schemaDataField unit size1of2

“><div class=”schema_field” data-schema-path=”asset_element_project_common.agency.5315acdce4b05c06b581309e#_cm.asset.common.brand”>
<label for=”common_prop_schema_FilteringSelect_7″><div class=”required_field”>Brand</div></label>
<div widgetid=”common_prop_schema_FilteringSelect_7″ aria-disabled=”true” class=”dijit dijitReset dijitInline dijitLeft dijitTextBox dijitComboBox dijitValidationTextBox dijitTextBoxDisabled dijitComboBoxDisabled dijitValidationTextBoxDisabled dijitDisabled” id=”widget_common_prop_schema_FilteringSelect_7″ role=”combobox” aria-haspopup=”true” data-dojo-attach-point=”_popupStateNode”><div class=”dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer” data-dojo-attach-point=”_buttonNode” role=”presentation”><input class=”dijitReset dijitInputField dijitArrowButtonInner” value=”▼ ” tabindex=”-1″ readonly=”readonly” role=”button presentation” aria-hidden=”true” type=”text”></div><div class=”dijitReset dijitValidationContainer”><input class=”dijitReset dijitInputField dijitValidationIcon dijitValidationInner” value=”Χ ” tabindex=”-1″ readonly=”readonly” role=”presentation” type=”text”></div><div class=”dijitReset dijitInputField dijitInputContainer”><input aria-invalid=”false” value=”” aria-required=”true” aria-disabled=”true” disabled=”” data-role=”schemaField” id=”common_prop_schema_FilteringSelect_7″ tabindex=”-1″ class=”dijitReset dijitInputInner” autocomplete=”off” data-dojo-attach-point=”textbox,focusNode” role=”textbox” type=”text”><input value=”” disabled=”” name=”_cm.asset.common.brand” type=”hidden”></div></div>
</div></div><div class=”schemaDataField unit size1of2

“><div class=”schema_field” data-schema-path=”asset_element_project_common.agency.5315acdce4b05c06b581309e#_cm.asset.common.sub_brand”>
<label for=”common_prop_schema_FilteringSelect_8″><div class=”required_field”>Product</div></label>
<div widgetid=”common_prop_schema_FilteringSelect_8″ aria-disabled=”true” class=”dijit dijitReset dijitInline dijitLeft dijitTextBox dijitComboBox dijitValidationTextBox dijitTextBoxDisabled dijitComboBoxDisabled dijitValidationTextBoxDisabled dijitDisabled” id=”widget_common_prop_schema_FilteringSelect_8″ role=”combobox” aria-haspopup=”true” data-dojo-attach-point=”_popupStateNode”><div class=”dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer” data-dojo-attach-point=”_buttonNode” role=”presentation”><input class=”dijitReset dijitInputField dijitArrowButtonInner” value=”▼ ” tabindex=”-1″ readonly=”readonly” role=”button presentation” aria-hidden=”true” type=”text”></div><div class=”dijitReset dijitValidationContainer”><input class=”dijitReset dijitInputField dijitValidationIcon dijitValidationInner” value=”Χ ” tabindex=”-1″ readonly=”readonly” role=”presentation” type=”text”></div><div class=”dijitReset dijitInputField dijitInputContainer”><input aria-invalid=”false” value=”” aria-required=”true” aria-disabled=”true” disabled=”” data-role=”schemaField” id=”common_prop_schema_FilteringSelect_8″ tabindex=”-1″ class=”dijitReset dijitInputInner” autocomplete=”off” data-dojo-attach-point=”textbox,focusNode” role=”textbox” type=”text”><input value=”” disabled=”” name=”_cm.asset.common.sub_brand” type=”hidden”></div></div>
</div></div><div class=”schemaDataField unit size1of2

“><div class=”schema_field relative” data-schema-path=”tv_order_item.market.3#_cm.common.title”>
<label>
<div class=”inline-block required_field”>Title</div>
<input widgetid=”common_prop_schema_TextField_2″ placeholder=”” id=”common_prop_schema_TextField_2″ data-role=”schemaField” name=”_cm.common.title” value=”” data-dojo-type=”common.prop_schema.TextField” data-dojo-props=”data:dojo.getObject(&quot;_refs.6.0&quot;),
disabled : false,
required: true,
placeholder: ”” required=”” class=”ui-input” type=”text”>
</label>
</div></div><div class=”schemaDataField unit size1of2

“><div class=”schema_field relative” data-schema-path=”tv_order_item.market.3#_cm.common.duration”>
<label>
<div class=”inline-block required_field”>Duration</div>
<input widgetid=”common_prop_schema_TextField_3″ placeholder=”e.g., 1mn 20s” id=”common_prop_schema_TextField_3″ data-role=”schemaField” name=”_cm.common.duration” value=”” data-dojo-type=”common.prop_schema.TextField” data-dojo-props=”data:dojo.getObject(&quot;_refs.7.0&quot;),
disabled : false,
required: true,
placeholder: ‘e.g., 1mn 20s'” required=”” class=”ui-input” type=”text”>
</label>
</div></div><div class=”schemaDataField unit size1of2

“><div class=”schema_field tv_order_item.market.3__cm_common_firstAirDate” data-schema-path=”tv_order_item.market.3#_cm.common.firstAirDate”>
<div class=”required_field label”>First Air Date</div>
<div>
<div widgetid=”common_prop_schema_DateTextBox_1″ class=”dijit dijitReset dijitInline dijitLeft test_startdate startdate date none-shadow dijitTextBox dijitComboBox dijitDateTextBox dijitValidationTextBox dijitTextBoxIncomplete dijitComboBoxIncomplete dijitDateTextBoxIncomplete dijitValidationTextBoxIncomplete dijitIncomplete” id=”widget_common_prop_schema_DateTextBox_1″ role=”combobox” aria-haspopup=”true” data-dojo-attach-point=”_popupStateNode”><div class=”dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer” data-dojo-attach-point=”_buttonNode” role=”presentation”><input class=”dijitReset dijitInputField dijitArrowButtonInner” value=”▼ ” tabindex=”-1″ readonly=”readonly” role=”button presentation” aria-hidden=”true” type=”text”></div><div class=”dijitReset dijitValidationContainer”><input class=”dijitReset dijitInputField dijitValidationIcon dijitValidationInner” value=”Χ ” tabindex=”-1″ readonly=”readonly” role=”presentation” type=”text”></div><div class=”dijitReset dijitInputField dijitInputContainer”><input aria-invalid=”true” value=”” aria-required=”true” data-role=”schemaField” id=”common_prop_schema_DateTextBox_1″ tabindex=”0″ class=”dijitReset dijitInputInner” autocomplete=”off” data-dojo-attach-point=”textbox,focusNode” role=”textbox” type=”text”><input value=”” name=”_cm.common.firstAirDate” type=”hidden”></div></div>
</div>
</div></div><div class=”schemaDataField unit size1of2

“><div class=”schema_field” data-schema-path=”tv_order_item.market.3#_cm.common.format”>
<label for=”common_prop_schema_FilteringSelect_9″><div class=””>Format</div></label>
<div widgetid=”common_prop_schema_FilteringSelect_9″ aria-disabled=”false” class=”dijit dijitReset dijitInline dijitLeft dijitTextBox dijitComboBox dijitValidationTextBox” id=”widget_common_prop_schema_FilteringSelect_9″ role=”combobox” aria-haspopup=”true” data-dojo-attach-point=”_popupStateNode”><div class=”dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer” data-dojo-attach-point=”_buttonNode” role=”presentation”><input class=”dijitReset dijitInputField dijitArrowButtonInner” value=”▼ ” tabindex=”-1″ readonly=”readonly” role=”button presentation” aria-hidden=”true” type=”text”></div><div class=”dijitReset dijitValidationContainer”><input class=”dijitReset dijitInputField dijitValidationIcon dijitValidationInner” value=”Χ ” tabindex=”-1″ readonly=”readonly” role=”presentation” type=”text”></div><div class=”dijitReset dijitInputField dijitInputContainer”><input aria-invalid=”false” value=”” aria-required=”false” aria-disabled=”false” data-role=”schemaField” id=”common_prop_schema_FilteringSelect_9″ tabindex=”0″ class=”dijitReset dijitInputInner” autocomplete=”off” data-dojo-attach-point=”textbox,focusNode” role=”textbox” type=”text”><input value=”” name=”_cm.common.format” type=”hidden”></div></div>
</div></div><div class=”schemaDataField unit size1of1

“><div class=”schema_field” data-schema-path=”tv_order_item.market.3#_cm.common.additionalInformation”>
<label>
<div class=””>Additional Details</div>
<div>
<textarea widgetid=”common_prop_schema_TextArea_1″ rows=”5″ id=”common_prop_schema_TextArea_1″ name=”_cm.common.additionalInformation” data-dojo-type=”common.prop_schema.TextArea” data-role=”schemaField” data-dojo-props=”data:dojo.getObject(&quot;_refs.10.0&quot;),
disabled : false,
required: false,
rows: ‘5’” class=”ui-input”></textarea>
</div>
</label>
</div></div></div>
</div><div class=”freeColumnFields unit-right size3of10″><div class=”schema_field_wrapper unit size1of2″ data-role=”schemaFieldWrapper”><div class=”schemaDataField unit size1of1

“><div class=”schema_field” data-schema-path=”market_schema.agency.5315acdce4b05c06b581309e.market.3#_cm.metadata.subtitlesRequired”>
<label for=”common_prop_schema_FilteringSelect_10″><div class=”required_field”>Subtitles Required</div></label>
<div widgetid=”common_prop_schema_FilteringSelect_10″ aria-disabled=”false” class=”dijit dijitReset dijitInline dijitLeft dijitTextBox dijitComboBox dijitValidationTextBox dijitTextBoxIncomplete dijitComboBoxIncomplete dijitValidationTextBoxIncomplete dijitIncomplete” id=”widget_common_prop_schema_FilteringSelect_10″ role=”combobox” aria-haspopup=”true” data-dojo-attach-point=”_popupStateNode”><div class=”dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonContainer” data-dojo-attach-point=”_buttonNode” role=”presentation”><input class=”dijitReset dijitInputField dijitArrowButtonInner” value=”▼ ” tabindex=”-1″ readonly=”readonly” role=”button presentation” aria-hidden=”true” type=”text”></div><div class=”dijitReset dijitValidationContainer”><input class=”dijitReset dijitInputField dijitValidationIcon dijitValidationInner” value=”Χ ” tabindex=”-1″ readonly=”readonly” role=”presentation” type=”text”></div><div class=”dijitReset dijitInputField dijitInputContainer”><input aria-invalid=”true” value=”” aria-required=”true” aria-disabled=”false” data-role=”schemaField” id=”common_prop_schema_FilteringSelect_10″ tabindex=”0″ class=”dijitReset dijitInputInner” autocomplete=”off” data-dojo-attach-point=”textbox,focusNode” role=”textbox” type=”text”><input value=”” name=”_cm.metadata.subtitlesRequired” type=”hidden”></div></div>
</div></div></div><div class=”schema_field_wrapper unit size1of2″ data-role=”schemaFieldWrapper”><div class=”schemaDataField unit size1of1

“><div widgetid=”common_prop_schema_UploadedFiles_1″ id=”common_prop_schema_UploadedFiles_1″ class=”schema_field mtm” data-dojo-type=”common.prop_schema.UploadedFiles” data-dojo-props=”data:dojo.getObject(&quot;_refs.13.0&quot;)” data-schema-path=”tv_order_item.market.3#_cm.common.uploadedFiles”>
<div widgetid=”common_plupload_noModalWindow_1″ id=”common_plupload_noModalWindow_1″ class=”button mtxs” data-dojo-props=”data: { type : ‘documents’ }, src: ‘/uploader’ ” data-dojo-type=”common.plupload.noModalWindow”>
<span class=”icon-upload-lib valign-middle”></span>
<span class=”valign-middle”>Upload Document</span>
</div>
<div class=”mts pas b-documents none” data-role=”_cm.common.uploadedFiles”></div>
</div></div></div></div></div></div></div>
</div>
</div>

laxmisomni Train Asked on February 6, 2015 in Selenium WebDriver.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.