how i can select data from a combo box and fires onchange command using VBA-excel - excel

i want to select "56 - Hoyer (Suk / Rontec)" in the combo box and then fire the event that reloads the page using VBA excel, i can put the text on the combo box, but it doesnt load tha javascript attached to it (onchange event).
see image of the drop down / combo box here
below is the code i use in VBA to fill out the combobox with a constant value. but i cannot run the onchange event on html provided.
Call IE.document.getElementById("orders.carrier_number_txtSelectionDisplay").setAttribute("value", "56 - Hoyer (Suk / Rontec)")
Call IE.document.getElementById("orders.carrier_number_txtSelectionDisplay").setAttribute("value", "56 - Hoyer (Suk / Rontec)")
Set x = IE.document.getElementById(orders.carrier_number_txtSelectedValue)
x.Focus
x.FireEvent "onchange"
Below is the HTML code:
<td>
<div>
<span id="Descriptor.orders.carrier_number" class="dataentry-descriptor dataentry-descriptor-top" style="text-align:left;">Carrier</span>
</div>
<div class="dataentry-field-control" style="text-align:left;">
<div id="orders.carrier_number_4b7bc829-2760-4042-aab0-be8ccfb9541b" timerid="" querymethodname="GetSupplierCarriers">
<div id="orders.carrier_number_pnlSelectionDisplay" class="ffnet-combo-box dataentry-field required" style="width:180px;">
<table border="0" style="border-spacing: 0px; border-collapse: collapse; margin:0px;">
<colgroup>
<col style="width: 100%">
<col style="width: 30px; text-align: right;">
</colgroup>
<tbody>
<tr>
<td style="padding: 0px;">
<input name="orders.carrier_number$txtSelectionDisplay" type="text" id="orders.carrier_number_txtSelectionDisplay" class="dataentry-field required validate[required] required" isrequired="True" datatype="3"
onkeydown="javascript:return InputProcessKeyDown('orders.carrier_number_4b7bc829-2760-4042-aab0-be8ccfb9541b', event);" onfocus="javascript:return InputProcessOnFocus('orders.carrier_number_4b7bc829-2760-4042-aab0-be8ccfb9541b');
" style="width:150px;">
<input name="orders.carrier_number$txtSelectedValue" type="text" onchange="retrieveChildData("orders.carrier_number_4b7bc829-2760-4042-aab0-be8ccfb9541b","orders.loaded_driver_number_e5ba36ca-
aa0f-4f55-aa3e-c7cb342d0b0b"); retrieveChildData("orders.carrier_number_4b7bc829-2760-4042-aab0-be8ccfb9541b","orders.delivered_driver_number_e7747c68-df71-4774-9b04-
d897d1fd9833"); retrieveChildData("orders.carrier_number_4b7bc829-2760-4042-aab0-be8ccfb9541b","orders.vehicle_code_d3cc805c-e505-45c5-a351-98028439e34d"); retrieveChildData("orders.carrier_number_4b7bc829-
2760-4042-aab0-be8ccfb9541b","orders.tractor_number_089faa52-6810-4815-8f64-81eb201105a2"); UpdateDirtyBit(1);setTimeout('__doPostBack(\'orders.carrier_number$txtSelectedValue\',\'\')', 0)"
onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" id="orders.carrier_number_txtSelectedValue" datavaluefield="carrier_number" assembly="FFNET_CORE" funcname="OrderDispatch_DeleteOrderTrailer"
methodclass="CBL" hasautopostback="true" namespace="FBS" selectlistargs="{"SenderId":"orders.carrier_number","supplier_number":"139","RequiresParent":"True"}" style="display:none;">
</td>
<td>
<img id="orders.carrier_number_imgArrow" onclick="InputProcessOnFocus('orders.carrier_number_4b7bc829-2760-4042-aab0-be8ccfb9541b'); activeCB.toggleDropDown();" src="/ffnet/Images/DropDownListArrow.gif">
</td>
</tr>
</tbody>
</table>
</div>
<div id="orders.carrier_number_pnlDropDownList" class="ffnet-combo-box-ddlist" style="width:339px;">
<div id="orders.carrier_number_pnlDropDownRegion" class="ffnet-combo-box-ddregion" value="" style="width:339px;">
<table header="0" style="width:322px;" cellspacing="0" cellpadding="0">
<colgroup>
<col style="width:80px;">
<col style="width:210px;">
</colgroup>
<tbody>
<tr>
<th>Carrier Number</th>
<th>Name</th>
</tr>
</tbody>
</table>
<div id="orders.carrier_number_pnlDataRegion" class="ffnet-combo-box-data" style="width:339px;height:200px;">
<table style="width:322px;" onkeydown="javascript:return ProcessKeyDown(this, event);" tabindex="0" mode="combobox">
<colgroup>
<col style="width:80px;">
<col style="width:210px;">
</colgroup>
<tbody>
<tr id="orders.carrier_number_tr0" pk="1" text="1 - Armac Shipping" class="ffnet-combo-box-row-focus">
<td>1</td>
<td>Armac Shipping</td>
</tr>
<tr id="orders.carrier_number_tr1" pk="2" text="2 - IPCS Ltd">
<td>2</td>
<td>IPCS Ltd</td>
</tr>
<tr id="orders.carrier_number_tr23" pk="56" text="56 - Hoyer (Suk / Rontec)">
<td>56</td>
<td>Hoyer (Suk / Rontec)</td>
</tr>
</tbody>
</table>
</div>
<div id="orders.carrier_number_pnlPager" class="ffnet-combo-box-paging" title="Click for more records" onclick="RetrieveNextPage($("[id$='orders.carrier_number_4b7bc829-2760-4042-aab0-be8ccfb9541b']").get(0), false);
" recordcount="129">
1-30 of 129 results
</div>
</div>
</div>
</div>
<input type="hidden" name="orders.carrier_number_txtSelectedValue_hdnDirtyBit" id="orders.carrier_number_txtSelectedValue_hdnDirtyBit" value="0">
</div>

Related

Selecting Date from the Datepicker. How do I do that using WATIR

I don't know how to select the date from the date picker, For an example, If I want to select 1/5/2022, how would I do that?
here is the pic
Here is the Html
<div style="visibility: visible; overflow: visible; left: 589px; top: 193px; position: absolute;"
class="gwt-PopupPanel">
<div class="popupContent">
<table class="gwt-DatePicker" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="vertical-align: top;" align="left">
<table class="datePickerMonthSelector">
<colgroup>
<col>
<col>
<col>
<col>
<col>
</colgroup>
<tbody>
<tr>
<td width="1">
<div tabindex="0" class="datePickerPreviousButton" role="button" aria-pressed="false">
<input type="text" tabindex="-1" aria-hidden="true"
style="opacity: 0; height: 1px; width: 1px; z-index: -1; overflow: hidden; position: absolute;">
<div class="html-face">«</div>
</div>
</td>
<td width="1">
<div tabindex="0" class="datePickerPreviousButton" role="button" aria-pressed="false">
<input type="text" tabindex="-1" aria-hidden="true"
style="opacity: 0; height: 1px; width: 1px; z-index: -1; overflow: hidden; position: absolute;">
<div class="html-face">‹</div>
</div>
</td>
<td class="datePickerMonth" width="100%">Nov 2022</td>
<td width="1">
<div tabindex="0" class="datePickerNextButton datePickerNextButton-up" role="button"
aria-pressed="false"><input type="text" tabindex="-1" aria-hidden="true"
style="opacity: 0; height: 1px; width: 1px; z-index: -1; overflow: hidden; position: absolute;">
<div class="html-face">›</div>
</div>
</td>
<td width="1">
<div tabindex="0" class="datePickerNextButton datePickerNextButton-up" role="button"
aria-pressed="false"><input type="text" tabindex="-1" aria-hidden="true"
style="opacity: 0; height: 1px; width: 1px; z-index: -1; overflow: hidden; position: absolute;">
<div class="html-face">»</div>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="vertical-align: top;" align="left">
<table class="datePickerDays" cellspacing="0" cellpadding="0" border="0">
<colgroup>
<col>
<col>
<col>
<col>
<col>
<col>
<col>
</colgroup>
<tbody>
<tr>
<td class="datePickerWeekendLabel">S</td>
<td class="datePickerWeekdayLabel">M</td>
<td class="datePickerWeekdayLabel">T</td>
<td class="datePickerWeekdayLabel">W</td>
<td class="datePickerWeekdayLabel">T</td>
<td class="datePickerWeekdayLabel">F</td>
<td class="datePickerWeekendLabel">S</td>
</tr>
<tr>
<td>
<div tabindex="-1" aria-selected="false"
class="datePickerDay datePickerDayIsWeekend datePickerDayIsFiller ">30
</div>
</td>
<td>
<div tabindex="-1" aria-selected="false" class="datePickerDay datePickerDayIsFiller ">
31
</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">1</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">2</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">3</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">4</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay datePickerDayIsWeekend ">
5
</div>
</td>
</tr>
<tr>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay datePickerDayIsWeekend ">
6
</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">7</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">8</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">9</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">10</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">11</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay datePickerDayIsWeekend ">
12
</div>
</td>
</tr>
<tr>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay datePickerDayIsWeekend ">
13
</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">14</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">15</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">16</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">17</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">18</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay datePickerDayIsWeekend ">
19
</div>
</td>
</tr>
<tr>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay datePickerDayIsWeekend ">
20
</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">21</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">22</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">23</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">24</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">25</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay datePickerDayIsWeekend ">
26
</div>
</td>
</tr>
<tr>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay datePickerDayIsWeekend ">
27
</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">28</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">29</div>
</td>
<td>
<div tabindex="0" aria-selected="false" class="datePickerDay ">30</div>
</td>
<td>
<div tabindex="-1" aria-selected="false" class="datePickerDay datePickerDayIsFiller ">
1
</div>
</td>
<td>
<div tabindex="-1" aria-selected="false" class="datePickerDay datePickerDayIsFiller ">
2
</div>
</td>
<td>
<div tabindex="-1" aria-selected="false"
class="datePickerDay datePickerDayIsWeekend datePickerDayIsFiller ">3
</div>
</td>
</tr>
<tr>
<td>
<div tabindex="-1" aria-selected="false"
class="datePickerDay datePickerDayIsWeekend datePickerDayIsFiller ">4
</div>
</td>
<td>
<div tabindex="-1" aria-selected="false" class="datePickerDay datePickerDayIsFiller ">
5
</div>
</td>
<td>
<div tabindex="-1" aria-selected="false" class="datePickerDay datePickerDayIsFiller ">
6
</div>
</td>
<td>
<div tabindex="-1" aria-selected="false" class="datePickerDay datePickerDayIsFiller ">
7
</div>
</td>
<td>
<div tabindex="-1" aria-selected="false" class="datePickerDay datePickerDayIsFiller ">
8
</div>
</td>
<td>
<div tabindex="-1" aria-selected="false" class="datePickerDay datePickerDayIsFiller ">
9
</div>
</td>
<td>
<div tabindex="-1" aria-selected="false"
class="datePickerDay datePickerDayIsWeekend datePickerDayIsFiller ">10
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
The general approach needs to be:
Use the month previous/next buttons to select the month/year
Click the specific day (making sure to ignore the days for the previous/next month)
The code would look like:
# The day you would like to pick
target_date = Time.parse('1/5/2022')
# Pick the month/year (by determining how many months in the past/future you need to go)
current_date = Time.parse(browser.td(class: 'datePickerMonth').text)
months_to_increment = (target_date.year * 12 + target_date.month) - (current_date.year * 12 + current_date.month) # From https://stackoverflow.com/a/9428676/1200545
months_to_increment.abs.times do
if months_to_increment > 0
browser.div(class: 'datePickerNextButton', index: 0).click
else
browser.div(class: 'datePickerPreviousButton', index: 1).click
end
end
# Pick the day (ignoring the datePickerDayIsFiller divs as they are the previous/next month)
browser.div(text: target_date.day.to_s, class: ['datePickerDay', '!datePickerDayIsFiller']).click

How to get the text from this element?

I use selenium webdriver with node js.
I cannot get the text from this site. I need the "In progress" text.
I don't want to use absolute xpath, because I want use the code in other tests.
Thank you. :)
<div class="issuePanelContainer" id="issue_actions_container"
style="height: auto;">
<table cellpadding="0" cellspacing="0" border="0" width="100%"> .
</table>
<div class="issue-data-block">
<div class="actionContainer">
<div class="action-details">
<span class="aui-avatar aui-avatar-xsmall">
<span class="aui-avatar-inner">
<img alt="" src="https://jira.au.flitech.net/secure/useravatar?size=xsmall&ownerId=jan.plzak%40flightcentre.co.uk&avatarId=12582">
</span>
</span>
<a class="user-hover" rel="jan.plzak#flightcentre.co.uk" id="email_jan.plzak#flightcentre.co.uk" href="/secure/ViewProfile.jspa?name=jan.plzak%40flightcentre.co.uk">Jan Plzak</a>
made transition
- <span class="date" title="18/Jun/19 4:57 PM"><time class="livestamp" datetime="2019-06-18T16:57:08+1000">18/Jun/19 4:57 PM</time></span>
</div>
<div class="changehistory action-body">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody><tr>
<td width="60%">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tbody><tr>
<td width="47%" align="right">
<span class=" jira-issue-status-lozenge aui-lozenge jira-issue-status-lozenge-blue-gray jira-issue-status-lozenge-new jira-issue-status-lozenge-max-width-medium" data-tooltip="<span class="jira-issue-status-tooltip-title">Open</span>" title="" original-title="">Open</span> </td>
<td align="center" nowrap="nowrap" width="6%">
<img src="/images/icons/arrow_right_small.gif" align="absmiddle" border="0" height="16" width="16">
</td>
<td width="47%">
<span class=" jira-issue-status-lozenge aui-lozenge jira-issue-status-lozenge-yellow jira-issue-status-lozenge-indeterminate jira-issue-status-lozenge-max-width-medium" data-tooltip="<span class="jira-issue-status-tooltip-title">In Progress</span><br><span class="jira-issue-status-tooltip-desc">The development task is currently in progress</span>" title="" original-title="">In Progress</span></td>
</tr>
</tbody></table>
</td>
<td width="20%">
13d 21h 18m
</td>
<td width="20%" align="center">
1
</td>
</tr>
</tbody></table>
</div>
List<WebElement> list=driver.findElement(By.xpath("//span[contains(#class,'status')]"));
for(WebElement li:list)
{
if(li.getText().equals("In progress")
{
li.click(); // or assert or whatever
}
}
This is my answer, which is working fine, and content free. :)
driver.findElements(By.xpath('//div[#class="changehistory action-body"]/table/tbody/tr/td/table/tbody/tr/td[1]/span'));

How to Scroll and Select/Doubleclick a listbox item?

I'm trying to get Intranet-web reports using VBA-Excel. How can I scroll to the item in a list and select or double-click it?
I located the item using ID of its parent-element and its own class and innertext values. I tried .click method in many ways, but without success.
Sub VBA_IE()
Dim IE As New SHDocVw.InternetExplorerMedium
Dim HTMLDoc As MSHTML.HTMLDocument
Dim HTMLDiv As MSHTML.IHTMLElement
Dim HTMLDivs As MSHTML.IHTMLElementCollection
'
'Here is IE object set and the page loaded
'
Set HTMLDoc = IE.document
Set HTMLDivs = HTMLDoc.getElementById "id_mstr104ListContainer").getElementsByTagName("div")
For Each HTMLDiv In HTMLDivs
If HTMLDiv.getAttribute("title") = "Fourth Center" Then
HTMLDiv.Focus
HTMLDiv.click
'wait-routines
Application.Wait Now + TimeValue("00:00:05")
Exit For
Else
End If
Next HTMLDiv
IE.Quit
Set IE = Nothing
End Sub
Part of page's source (extended on Feb 20 2019):
<div style="display: block;" class="mstrPromptQuestion" id="id_mstr80">
<span class="">
<div class="mstrPromptQuestionTitleBar">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td align="left" valign="middle">
<span class="mstrPromptQuestionTitleBarIndex" style="display: inline;">1.</span>
<span class="mstrPromptQuestionTitleBarTitle">Delivery Source</span>
<span class="mstrPromptQuestionTitleBarRequired" title="(Required)">(Required)</span>
</td>
<td width="1%" align="right" valign="middle">
<img src="../images/1ptrans.gif" align="absmiddle" style="display: none" class="mstrPromptQuestionBackToTopImg" title="Back to top" onclick="mstr.behaviors.PromptQuestion.onClickBackToTop('id_mstr80')">
</td>
</tr>
</tbody>
</table>
</div>
<table cellspacing="0" cellpadding="0" class="mstrPromptQuestionInfoTable">
<tbody>
<tr>
<td class="mstrPromptQuestionInfoCellLeft">
<div class="mstrPromptQuestionMeaning" style="display: block;">Select items for Delivery Source</div>
<div class="mstrPromptQuestionInstructions" style="display: none;"></div>
<div class="mstrPromptQuestionMessage" style="display: none;"></div>
</td>
<td class="mstrPromptQuestionInfoCellRight">
<span class="mstrPlaceholder" name="saveAnswerView" id="id_mstr81"></span>
</td>
</tr>
</tbody>
</table>
<div class="mstrPromptQuestionContents">
<table cellspacing="0" cellpadding="0" class="mstrPromptQuestionSimpleAnswerViewTitle" style="display: none;">
<tbody>
<tr>
<td class="mstrPromptQuestionSimpleAnswerViewTitleCellRadio">
<input value="0" name="id_mstr80_radio" onmousedown="mstr.behaviors.PromptQuestion.onClickRadio('id_mstr80', false)" id="id_mstr80_radio_simpleAnswerView" type="radio" checked="true">
</td>
<td class="mstrPromptQuestionSimpleAnswerViewTitleCellText">
<label for="id_mstr80_radio_simpleAnswerView">Your selection:</label>
</td>
</tr>
</tbody>
</table>
<div style="padding-left: 0px;" class="mstrPromptQuestionSimpleAnswerView" onmousedown="this.previousSibling.rows[0].cells[0].childNodes[0].checked = true; mstr.behaviors.PromptQuestion.onClickRadio('id_mstr80', false)">
<table cellspacing="0" style="display: table;" cellpadding="0" class="mstrListCart" id="id_mstr84">
<colgroup><col class="mstrListCartLeftCol"><col class="mstrListCartButtonCol"><col class="mstrListCartRightCol"><col class="mstrListCartButtonCol"></colgroup>
<tbody>
<tr>
<td class="mstrListCartRowPathView" style="width:100%;" colspan="4">
<table cellspacing="0" cellpadding="0" class="mstrListCartTablePathView" style="display: none;">
<tbody>
<tr>
<td class="mstrListCartCellPathView">
<span class="mstrPlaceholder" name="pathView" id="id_mstr87"></span>
</td>
<td class="mstrListCartCellPathUpButton">
<span class="mstrPlaceholder" name="pathUpButton" id="id_mstr88"></span>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="mstrListCartCellSearchView" style="width:100%;" colspan="4">
<div title="" class="mstrSearchField" id="id_mstr99" style="display: block;">
<table cellspacing="0" cellpadding="0" class="mstrSearchFieldTable">
<tbody>
<tr>
<td class="mstrSearchFieldSearchBox">
<div title="" class="mstrTextBoxWithIcon" id="id_mstr102" style="display: block;">
<div class="mstrTextBoxWithIconCaption">
<label for="id_mstr102_txt">Search for:</label>
</div>
<table cellspacing="0" cellpadding="0" class="mstrTextBoxWithIconTable">
<tbody>
<tr>
<td class="mstrTextBoxWithIconCellInput">
<div>
<input maxlength="" onclick="if (mstr.utils.ISW3C) {this.focus();}" onkeypress="return mstr.behaviors.TextBoxWithIcon.onkeypress(arguments[0], self, 'id_mstr102', this.value)" name="id_mstr102_txt" style="background-color: rgb(255, 255, 255);" id="id_mstr102_txt" size="" type="text">
</div>
</td>
<td class="mstrTextBoxWithIconCellIcon">
<div class="mstrToolButtonRoundedRight">
<input type="button" title="Search" onmouseout="mstr.behaviors.ToolButtonRounded.unhover(this.parentNode)" style="background-position: left center; cursor: pointer;" class="mstrBGIcon_tbSearch" src="../images/1ptrans.gif" onmouseover="mstr.behaviors.ToolButtonRounded.hover(this.parentNode)" onclick="mstr.behaviors.TextBoxWithIcon.fire('id_mstr102', this.parentNode.parentNode.previousSibling.childNodes[0].childNodes[0].value);return false;">
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td class="mstrSearchFieldMatchCaseBox">
<div class="mstrCheckBox" style="display: block;" id="id_mstr103">
<input type="checkbox" id="id_mstr103_input" onclick="mstr.$obj('id_mstr103').getModel() && mstr.$obj('id_mstr103').getModel().set('searchMatchCase', this.checked); mstr.$obj('id_mstr103').fireCommands(null, this.checked);">
<label title="" for="id_mstr103_input">Match case</label>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
<tr>
<td class="mstrListCartCellAvailableView">
<table cellspacing="0" cellpadding="0" style="table-layout: auto; width: 100%;">
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
<table cellspacing="0" cellpadding="0" title="" class="mstrListBlock" id="id_mstr104" style="display: table; width: 100%;">
<tbody>
<tr>
<td class="mstrListBlockCell">
<span class="">
<div class="mstrListBlockCaption" style="display: block;">Available:</div>
<div class="mstrListBlockHeader" style="display: none">
<span class="mstrPlaceholder" name="headerView" id="id_mstr105"></span>
</div>
<div style="width: auto; height: 150px;" class="mstrListBlockContents" id="ListBlockContents_id_mstr104">
<div oncontextmenu="return mstr.behaviors.Generic.oncontextmenu(arguments[0], self, 'id_mstr104');" onmouseup="try{mstr.$obj('id_mstr104').focus();}catch(localerr){}; return mstr.behaviors.Generic.clearBrowserHighlights(self)" onmousedown="var retVal = mstr.behaviors.ListView.onmousedown(arguments[0], self, 'id_mstr104'); try{mstr.$obj('id_mstr104').focus();}catch(localerr){}; return retVal" ondblclick="return mstr.behaviors.ListView.ondblclick(arguments[0], self, 'id_mstr104')" class="mstrListBlockListContainer" id="id_mstr104ListContainer" style="display: block; height: 80px;">
<div class="mstrListBlockItemSelected" title="First Center">
<div class="mstrBGIcon_ae mstrListBlockItemName" style="background-position: 2px 50%; padding-left: 23px;">First</div>
</div>
<div class="mstrListBlockItem" title="Second Center">
<div class="mstrBGIcon_ae mstrListBlockItemName" style="background-position: 2px 50%; padding-left: 23px;">Second Center</div>
</div>
<div class="mstrListBlockItem" title="Third Added Center">
<div class="mstrBGIcon_ae mstrListBlockItemName" style="background-position: 2px 50%; padding-left: 23px;">Third Added Center</div>
</div>
<div class="mstrListBlockItem" title="Fourth Center">
<div class="mstrBGIcon_ae mstrListBlockItemName" style="background-position: 2px 50%; padding-left: 23px;">Fourth Center</div>
</div>
</div>
<div class="mstrListBlockReadyState" style="display: none;"></div>
<div class="mstrListBlockMessageSection" style="display: none;">
<div class="mstrListBlockMessage"></div>
</div>
</div>
<a title="" href="#" onkeydown="return mstr.$obj('id_mstr104').onkeydown(arguments[0], self);" onkeypress="return mstr.$obj('id_mstr104').onkeypress(arguments[0], self);" class="mstrListBlockTabStop" id="id_mstr104TabStop">
<div></div>
</a>
</span>
</td>
</tr>
</tbody>
</table>
</td>
<td class="mstrListCartCellAddRemoveButtons">
<div>
<div class="mstrToolButtonRounded" id="id_mstr106" style="display: block;">
<img title="Add" onmouseout="mstr.behaviors.ToolButtonRounded.unhover(this.parentNode)" style="background-position: left center; cursor: pointer;" class="mstrBGIcon_tbAdd" src="../images/1ptrans.gif" onmouseover="mstr.behaviors.ToolButtonRounded.hover(this.parentNode)" align="absmiddle" onclick="var v = mstr.$obj('id_mstr106'); return (v.get('enabled')) ? mstr.$obj('id_mstr106').fireCommands() : false;">
</div>
</div>
<div>
<div class="mstrToolButtonRounded" id="id_mstr107" style="display: block;">
<img title="Add All" onmouseout="mstr.behaviors.ToolButtonRounded.unhover(this.parentNode)" style="background-position: left center; cursor: pointer;" class="mstrBGIcon_tbAddAll" src="../images/1ptrans.gif" onmouseover="mstr.behaviors.ToolButtonRounded.hover(this.parentNode)" align="absmiddle" onclick="var v = mstr.$obj('id_mstr107'); return (v.get('enabled')) ? mstr.$obj('id_mstr107').fireCommands() : false;">
</div>
</div>
<div style="height: 11px; width: 1px; overflow: hidden"></div>
<div>
<div class="mstrToolButtonRounded" id="id_mstr108" style="display: block; background-position: left center;">
<img title="Remove" onmouseout="mstr.behaviors.ToolButtonRounded.unhover(this.parentNode)" style="background-position: right center; cursor: default;" class="mstrBGIcon_tbRemove" src="../images/1ptrans.gif" onmouseover="mstr.behaviors.ToolButtonRounded.hover(this.parentNode)" align="absmiddle" onclick="var v = mstr.$obj('id_mstr108'); return (v.get('enabled')) ? mstr.$obj('id_mstr108').fireCommands() : false;">
</div>
</div>
<div>
<div class="mstrToolButtonRounded" id="id_mstr109" style="display: block; background-position: left center;">
<img title="Remove All" onmouseout="mstr.behaviors.ToolButtonRounded.unhover(this.parentNode)" style="background-position: right center; cursor: default;" class="mstrBGIcon_tbRemoveAll" src="../images/1ptrans.gif" onmouseover="mstr.behaviors.ToolButtonRounded.hover(this.parentNode)" align="absmiddle" onclick="var v = mstr.$obj('id_mstr109'); return (v.get('enabled')) ? mstr.$obj('id_mstr109').fireCommands() : false;">
</div>
</div>
</td>
<td class="mstrListCartCellSelectedView">
<table cellspacing="0" cellpadding="0" style="table-layout: auto; width: 100%;">
<tbody>
<tr>
<td>
<table cellspacing="0" cellpadding="0" title="" class="mstrListBlock" id="id_mstr110" style="display: table; width: 100%;">
<tbody>
<tr>
<td class="mstrListBlockCell"></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<span class="">
<div class="mstrListBlockCaption" style="display: block;">Selected:</div>
<div class="mstrListBlockHeader" style="display: none">
<span class="mstrPlaceholder" name="headerView" id="id_mstr111"></span>
</div>
<div style="width: auto; height: 150px;" class="mstrListBlockContents" id="ListBlockContents_id_mstr110">
<div oncontextmenu="return mstr.behaviors.Generic.oncontextmenu(arguments[0], self, 'id_mstr110');" onmouseup="try{mstr.$obj('id_mstr110').focus();}catch(localerr){}; return mstr.behaviors.Generic.clearBrowserHighlights(self)" onmousedown="var retVal = mstr.behaviors.ListView.onmousedown(arguments[0], self, 'id_mstr110'); try{mstr.$obj('id_mstr110').focus();}catch(localerr){}; return retVal" ondblclick="return mstr.behaviors.ListView.ondblclick(arguments[0], self, 'id_mstr110')" class="mstrListBlockListContainer" id="id_mstr110ListContainer" style="display: none; height: auto;"></div>
<div class="mstrListBlockReadyState" style="display: none;"></div>
<div class="mstrListBlockMessageSection" style="display: block;">
<div class="mstrListBlockMessage">(none)</div>
</div>
</div>
<a title="" href="#" onkeydown="return mstr.$obj('id_mstr110').onkeydown(arguments[0], self);" onkeypress="return mstr.$obj('id_mstr110').onkeypress(arguments[0], self);" class="mstrListBlockTabStop" id="id_mstr110TabStop">
<div></div>
</a>
</span>
</td>
<td class="mstrListCartCellUpDownButtons">
<span class="mstrPlaceholder" name="upButton" id="id_mstr96"></span>
<span class="mstrPlaceholder" name="downButton" id="id_mstr97"></span>
</td>
</tr>
<tr>
<td class="mstrListCartCellFetchView" colspan="4">
<table title="" cellspacing="0" style="display: table;" cellpadding="0" class="mstrFetchControl" id="id_mstr112">
<tbody>
<tr>
<td>
<img title="First page" src="../images/1ptrans.gif" align="absmiddle" onclick="mstr.behaviors.FetchControl.fireFetchCommand('id_mstr112', 'FetchFirst')" class="mstrBGIcon_fetchFirstDisabled " style="display: none;">
</td>
<td>
<img title="Previous Page" src="../images/1ptrans.gif" align="absmiddle" onclick="mstr.behaviors.FetchControl.fireFetchCommand('id_mstr112', 'FetchPrevious')" class="mstrBGIcon_fetchPreviousDisabled " style="display: none;">
</td>
<td class="mstrFetchControlCellText">
<div onmouseout="this.className = this.className.replace(/Hover/,'')" onmousedown="mstr.behaviors.FetchControl.on_mousedown('id_mstr112')" class="mstrFetchControlText" onmouseover="if (!this.disabled) this.className += 'Hover'">1 - 4 of 4</div>
</td>
<td>
<img title="Next page" src="../images/1ptrans.gif" align="absmiddle" onclick="mstr.behaviors.FetchControl.fireFetchCommand('id_mstr112', 'FetchNext')" class="mstrBGIcon_fetchNextDisabled " style="display: none;">
</td>
<td>
<img title="Last page" src="../images/1ptrans.gif" align="absmiddle" onclick="mstr.behaviors.FetchControl.fireFetchCommand('id_mstr112', 'FetchLast')" class="mstrBGIcon_fetchLastDisabled " style="display: none;">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<table cellspacing="0" cellpadding="0" class="mstrPromptQuestionComplexAnswerViewTitle" style="display: none;">
<tbody>
<tr>
<td class="mstrPromptQuestionComplexAnswerViewTitleCellRadio">
<input value="1" name="id_mstr80_radio" onmousedown="mstr.behaviors.PromptQuestion.onClickRadio('id_mstr80', true)" id="id_mstr80_radio_complexAnswerView" type="radio">
</td>
<td class="mstrPromptQuestionComplexAnswerViewTitleCellText">
<label for="id_mstr80_radio_complexAnswerView">The default selection is:</label>
</td>
</tr>
</tbody>
</table>
<div style="padding-left: 23px; display: none;" class="mstrPromptQuestionComplexAnswerView" onmousedown="this.previousSibling.rows[0].cells[0].childNodes[0].checked = true; mstr.behaviors.PromptQuestion.onClickRadio('id_mstr80', true)">
<div title="" class="mstrTextDiv" style="display: block;" id="id_mstr113">
<div class="mstrTextDivCaption"></div>
<div class="mstrTextDivValue"></div>
</div>
</div>
</div>
</span>
</div>
VBA-code just passes through the command line like nothing happened, or reports an error that the method is not applicable to the element.
Looks like you will need events to be fired but here are two things to try
ie.document.parentWindow.execScript "document.querySelector('[title^=Fourth]').setAttribute('class','mstrListBlockItemSelected');"
And
ie.document.querySelector("[title='Fourth Center']").FireEvent "ondblclick"

Objects in IE are not getting identified by VBA

Iam trying to automate IE Browser using VBA. There are nearly 25 links in the browser page but when i use getElementsByTagName("a") function VBA is identifying only 2 links form the page. Iam using IE 8 and MS Office 2007 package.
Have any one faced the same issue earlier. Kindly help
<form name="form1" action="/insurance/gs/servlet/API.gs.pol.nb.action.NewBizAction" method=post>
<input type="hidden" name='operId' value="">
<input type="hidden" name="policyId" value = "309865">
<input type="hidden" name='isCustomer' value="1">
<input type="hidden" name='indDeletePartyId' value="">
<input type="hidden" name='orgDeletePartyId' value="">
<input type="hidden" name='deletePartyId' value="">
<input type="hidden" name='roleType' value="">
<input type="hidden" name='submissionCustId' value="0">
<input type="hidden" name='newPartyId' value="null">
<input value="API.gs.pol.nb.action.NewBizAction?operId=LoaderCustInfo&policyId=309865" type="hidden" name="fromUrl" >
<table cellpadding="1" cellspacing="1" class="table_frame">
<tr>
<td class="body">
<div class="main">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="table_data">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" class="table_heading1">
<tr>
<td class="table_heading1_tdleft table_heading1_tdpic"></td>
<td class="table_heading1_td">
<table border="0" cellspacing="0" cellpadding="0" class="table_heading1_1">
<tr>
<td class="arrow_td"><img src="/insurance/icp/ifoundation/html/foundation/ui31/images/common/arrow1.gif" /></td>
<td width="49%" nowrap="nowrap" class="font_heading1">
Customer List
</td>
<td width="49%" align="right" >
<a class="a2" href="#" onClick="javascript:if(cheBefSelCust()){loadIndiCust()}">Individual</a>
<a class="a2" href="#" onClick="javascript:if(cheBefSelCust()){loadOrganCust()}">Company</a>
</td>
</tr>
</table>
</td>
<td class="table_heading1_tdright table_heading1_tdpic"></td>
</tr>
</table>
In the above HTML Page I want to Select the Link Individual

Find label name which doesn't contain input immediately from a table

I am having a table which contains multiple td/tr.
My problem is label which i want to get doesn't contains input immediately neither that label has any attributes property.
I want to get "Countries of Permanent Residence" and Dates which are in span but doesn't have any properties that span is in div that too doesn't contains any property.
I tried with
formElement[input[name="icims_gh_Permanent_Country_Residence"]]
But don't know how to get associate label.
Html looks like:
<div style="margin:0px">
<table style="width:100%" border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td valign="top">
<div style="margin:0px">
<span style="font-family:arial,helvetica,sans-serif;font-size:12px"> Countries of Permanent Residence (list all) </span>
</div>
</td>
<td valign="top">
<div style="margin:0px">
<span style="font-family:arial,helvetica,sans-serif;font-size:12px"> Dates </span>
</div>
</td>
</tr>
<tr>
<td colspan="2" valign="top">
<div style="margin:0px">
<div>
<input type="hidden" name="icims_gh_Permanent_Country_Residence" value="1">
<a name="0.1_icims_ga_Permanent_Country_Residence"></a>
<div>
<table style="width:100%;border:0px">
<tbody>
<tr>
<td>
<table style="width:100%" border="1" cellspacing="2" cellpadding="2">
<tbody>
<tr>
<td valign="top">
<div style="margin:0px">
<span style="font-family:arial,helvetica,sans-serif;font-size:12px">
<input type="text" name="icims_0_permResidenceCountry"> </span>
</div>
</td>
<td valign="top">
<div style="margin:0px">
<span style="font-family:arial,helvetica,sans-serif;font-size:12px">
<input type="text" name="icims_0_permResidenceCountryDates"> </span>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>

Resources