I'm trying to use Excel VBA to perform a very manual process in IE. I've worked with VBA and IE enough to do easy tasks like enter text into fields or interact with buttons, but I'm having a difficult time wrapping my head around this.
I have a list of fields in Excel: First Name, Last Name, Email Address. There are over two thousand rows of information in the spreadsheet. The website I'm working with has a list of over three thousand rows of information (same information with the addition of a checkbox), except it only loads a maximum of 100 rows at a time. Every row of data in Excel exists in the web tool.
I'd like to have my procedure iterate over the names and check the corresponding row on the webpage. The problem is figuring out how to identify the input id for the corresponding checkbox. I'm not very familiar with HTML so my code is very rudimentary... I've spent much of the day writing this:
Sub Test()
Dim str As String
Dim ie As SHDocVw.InternetExplorer
Dim doc As HTMLDocument
Dim tbls As Object
Dim tbl As Object
Dim trow As Object
Dim trs As Object
Dim Cell As Range
Set ie = New SHDocVw.InternetExplorer
ie.navigate "https://test.com"
ie.Visible = True
Set doc = ie.Document
Set tbls = doc.getElementsByTagName("TABLE")
For Each Cell In Range("A2:A2200")
For Each tbl In tbls
For Each trow In tbl.Rows
If InStr(1, trow.Cells(i).innerText, Cell.Offset(0, 1) & ", " & Cell) > 0 Then
Debug.Print trow.Cells(0).innerText
Stop
End If
Next trow
Next tbl
Next Cell
End Sub
The above code is able to identify the cell on the page that matches the cell in the workbook, but I can't figure out how to find the id to the associated checkbox. The site is private, so I can't provide a link. See below for what appears to be the relevant piece of source code for the site:
<div>
<table cellspacing="0" border="0" id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults" style="border-color:Black;border-width:1px;border-style:Solid;width:100%;border-collapse:collapse;">
<tr>
<td colspan="6">
<table id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_tabPager" border="0" cellpadding="5" width="100%">
<tr>
<td style="border-style:none;">
<a id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_lbPrev" disabled="disabled">Previous</a>
<a id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_lbNext" disabled="disabled">Next</a>
</td>
<td style="border-style:none;" align="right">
<b>Showing:</b>
<span id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow"><input id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_0" type="radio" name="ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow" value="10" checked="checked" /><label for="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_0">10 People</label><input id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_1" type="radio" name="ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow" value="25" onclick="javascript:setTimeout('__doPostBack(\'ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow$1\',\'\')', 0)" /><label for="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_1">25 People</label><input id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_2" type="radio" name="ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow" value="50" onclick="javascript:setTimeout('__doPostBack(\'ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow$2\',\'\')', 0)" /><label for="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_2">50 People</label><input id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_3" type="radio" name="ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow" value="100" onclick="javascript:setTimeout('__doPostBack(\'ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$rblShow$3\',\'\')', 0)" /><label for="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_rblShow_3">100 People</label></span>
</td>
</tr>
<tr id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl01_trSelectOptions">
<td colspan="2" style="border-style: none;" align="left">
Select All on Page
Clear All on Page
<a class="link_w_img" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$ctl09", "", true, "", "", false, true))">
<img src="/images/all.gif" />
<span>Select Entire List</span></a>
<a class="link_w_img" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl01$ctl11", "", true, "", "", false, true))">
<img src="/images/none.gif" />
<span>Clear Entire List</span></a>
</td>
</tr>
</table>
</td>
</tr>
<tr class="gridheader" align="left">
<th scope="col">Select</th>
<th scope="col">Last Name</th>
<th scope="col">First Name</th>
<th scope="col">Middle Name</th>
<th scope="col">E-mail Address</th>
<th scope="col" style="width:0px;"> </th>
</tr>
<tr class="griditem" align="center">
<td>
<input id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_SelectCheckBox" type="checkbox" name="ctl00$ctl00$all_content$all_content$content$ucUserSearch$gvSearchResults$ctl03$SelectCheckBox" />
</td>
<td align="left" onmouseover="ShowPopup('ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_divTip');" onmouseout="HidePopup();">Demo1</td>
<td align="left" onmouseover="ShowPopup('ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_divTip');" onmouseout="HidePopup();">Test</td>
<td align="left" onmouseover="ShowPopup('ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_divTip');" onmouseout="HidePopup();"> </td>
<td align="left" onmouseover="ShowPopup('ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_divTip');" onmouseout="HidePopup();">Demo1#Test.com</td>
<td style="width:0px;">
<div id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_divTip" class="popup">
<div class="popupbg">
<table>
<tr>
<td style="vertical-align:top;">
<span id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_lblName" style="font-weight:bold;">Demo1, Test </span>
<br />E-mail:<span id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_lblEmail">Demo1#Test.com</span><br />
<table cellspacing="0" border="0" id="ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_dgDemos" style="border-style:None;border-collapse:collapse;margin-top:-1.25em;">
<tr>
<td>
</td><td>
</td>
</tr><tr>
<td>
Employee ID:
</td><td>
N/A
</td>
</tr><tr>
<td>
Job Title:
</td><td>
N/A
</td>
</tr><tr>
<td>
Location:
</td><td>
N/A
</td>
</tr>
</table>
</td>
<td style="width:50px;vertical-align:top;">
<img src="/images/user_popup.jpg" border="0" width="48" height="48"/>
</td>
</tr>
</table>
</div>
</div>
</td>
In the above example, the Last Name is Demo1, the First Name is Test, and the Email is Demo1#Test.com, and the input id for the checkbox is ctl00_ctl00_all_content_all_content_content_ucUserSearch_gvSearchResults_ctl03_SelectCheckBox.
My question is, how do I identify the input id after I've identified table row? Or, perhaps that's impossible and I'm going about this the wrong way? Any thoughts will be much appreciated.
Edit
This is what I tried that gives me the Runtime error (Object variable or With block variable not set):
trow.Cells(0).getElementsByTagName("input")(0).Click
I also tried this:
set input = trow.Cells(0).getElementsByTagName("input")(0)
input.Click
And finally, both these produce the same error:
Debug.Print trow.Cells(0).getElementsByTagName("input")(0).innerText
Debug.Print trow.Cells(0).getElementsByTagName("input")(0)
This is the output of the Debug.Print in my original code:
Demo1, Test
E-mail: Demo1#Test.com
Employee ID: N/A
Job Title: N/A
Location: N/A
The only pieces I care about (in the output) are the first two lines, the email and name of the individual.
This test worked for me. Looks like the rows you want all have class="griditem", so you can check all table rows for that class name. When you find a match on that and on your cell values, you should be able to find the checkbox as shown.
Sub Tester()
Dim d As New HTMLDocument, trs, rw
d.body.innerHTML = _
"<section><table><tr class='griditem'><td>" & _
"<input type='checkbox' id='id_1'></td>" & _
"<td>Foo</td></tr><tr class='griditem'><td>" & _
"<input type='checkbox' id='id_2'></td>" & _
"<td>Bar</td></tr></table></section>"
Set trs = d.getElementsByTagName("tr")
For Each rw In trs
If rw.className = "griditem" Then
'check cell values for match....
Debug.Print rw.Cells(0).getElementsByTagName("input")(0).ID
End If
Next rw
End Sub
Give a try to this.
Set ElementCol = ie.Document.getElementsByTagName("input")
For Each btnInput In ElementCol
'your code here
Next btnInput
Related
This may straightforward for someone, so if you are that one please take a look at this:
I have a table with more rows, but one row I want to extract based on a given text, here is the table excerpt:
... <tr>
<td class="border-1px-solid-black" colspan="1">
<img onclick="PopupCenter('{{InvoiceDetails.0.Link}}')" style="max-height: 35px; max-width: 35px; cursor: pointer;" src="/images/report.png" /></td>
<td class="border-1px-solid-black" colspan="11">
<p>{{InvoiceDetails.0.Description}}</p>
</td>
<td class="border-1px-solid-black" colspan="2" style="text-align: right;">
<p>{{InvoiceDetails.0.Quantity}}</p>
</td>
<td class="border-1px-solid-black" colspan="2" style="text-align: right;">
<p>{{InvoiceDetails.0.Amount}} </p>
</td>
</tr>...
I am using HtmlAgilityPack and VB.NET and I want to get TR that contains InvoiceDetails.0 in any element.
How to do it?
Thanks!
I will post the way I've finished this, but this is not the shortest way:
nodes = doc.DocumentNode.SelectNodes("//*[text()[contains(., '" + find + "')]]")
If nodes IsNot Nothing Then
node = nodes(0)
While node.ParentNode.Name <> "tr"
node = node.ParentNode
End While
node = node.ParentNode
'and here I have reference to TR node
Next
End If
If you have shorter way please write here.
I am new to vb.net and need some help. I'm trying to autofill some fields on a website and press the send button, and I know how to do it when there is an ElementID:
WebBrowser1.Document.GetElementById("value")
But I'm stuck now on this webpage which has no ElemendIDs.
The HTML code is:
<tr>
<td align="center">
<br>
<br>
<form method="POST">
<table class="form">
<tr>
<td width="100">Login*</td>
<td><input type="text" name="login"></td>
</tr>
<tr>
<td>Password*</td>
<td><input type="text" name="password"></td>
</tr>
<tr>
<td>Full name</td>
<td><input type="text" name="full_name"></td>
</tr>
<tr>
<td>Account number</td>
<td><input type="text" name="account_number"></td>
</tr>
<tr>
<td>MAC</td>
<td><input type="text" name="stb_mac"></td>
</tr>
<tr>
<td>Account disabled</td>
<td><input type="checkbox" name="status" value="0"></td>
</tr>
<tr>
<td>Tariff plan</td>
<td>
<select name="tariff_plan_id">
<option value="0">---</option>
<option value="1">Full</option> </select>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Add"/></td>
</tr>
</table>
</form>
</td>
</tr>
How do I find the right values to write inside these fields? Also, how can I select <option value="1">Full</option> and then press the button to send the autofilled values to site?
Thank you for your help
EDIT:
#VisualVincent I tried your third example and managed to find:
<table class="form">
I'm now stuck on how to find this child:
<td><input type="text" name="login"></td>
This is what I tried:
If Element.GetAttribute("className") = "form" Then
Console.WriteLine("found form")
'Parent found.
'Inner loop, looking for the child element we want (<option value="5">Banana</option>).
For Each OptionElement As HtmlElement In Element.GetElementsByTagName("td")
If OptionElement.GetAttribute("name") = "login" Then
'Found. Do something with 'OptionElement'...
Console.WriteLine("login found")
ElementFound = True
Exit For 'Exit the inner loop.
End If
Next
End If
I also tried to find the other elements, for instance:
For Each OptionElement As HtmlElement In Element.GetElementsByTagName("input")
If OptionElement.GetAttribute("name") = "stb_mac" Then
Element.SetAttribute("value", variable(4))
ElementFound = True
Exit For 'Exit the inner loop.
End If
Next
And for some reason that doesn't work, but this does:
For Each Element As HtmlElement In WebBrowser1.Document.All 'Iterate all <select> tags. You can use Document.All here as well.
If Element.GetAttribute("name") = "login" Then Element.SetAttribute("value", variable(0))
If Element.GetAttribute("name") = "password" Then Element.SetAttribute("value", variable(1))
If Element.GetAttribute("name") = "full_name" Then Element.SetAttribute("value", variable(2))
If Element.GetAttribute("name") = "account_number" Then Element.SetAttribute("value", variable(3))
If Element.GetAttribute("name") = "stb_mac" Then Element.SetAttribute("value", variable(4))
Next
You're almost there. The only problem is here:
For Each OptionElement As HtmlElement In Element.GetElementsByTagName("td")
If OptionElement.GetAttribute("name") = "login" Then
You're simply iterating the wrong element type ("tag"). You're iterating <td> elements, whereas name="login" is applied to an <input> element.
Change the loop to the following, and it should work:
For Each OptionElement As HtmlElement In Element.GetElementsByTagName("input")
As a side note I also recommend you change the variable name to something which better describes what it actually is. OptionElement was used in my example because I iterate <option> elements, so in this case I'd name it InputElement instead:
For Each InputElement As HtmlElement In Element.GetElementsByTagName("input")
Then to programmatically put text in the input box/text box, simply use the SetAttribute() method to modify the value attribute:
InputElement.SetAttribute("value", "someTextHere")
I can successfully get innertext of <td> tags for both <table class="specs" ng-hide="false"> and <table class="specs ng-hide" ng-hide="true"> with this:
Set CHRA = aIE.document.getElementsByClassName("specs")(4).getElementsByTagName("td")
For Each Item In CHRA
Debug.Print Item.innertext
Next
These true and false html are from different urls, where one table is hidden and the other is visible to user. For True one, outputs are CHRA and 779543-0027, For False one, outputs are CHRA and 715214-0011:
I don't want to get the result for the false property. Is there any way that I can bypass this?
Here is the rest of the html code (true version is exactly the same except first part is <table class="specs ng-hide" ng-hide="true">:
<table class="specs" ng-hide="false">
<thead>
<tr>
<th colspan="2">BOM Info</th>
</tr>
</thead>
<tbody>
<tr>
<td>CHRA</td>
<td><span class="ng-binding">715214-0011</span> <input type="checkbox" ng-hide="bom.strChra[0]==undefined" id="cpbchra" class="combuy" value="715214-0011" style="display: none;"></td>
</tr>
</tbody>
</table>
I found the solution in case you are interested:
Set CHRA1 = aIE.document.getElementsByClassName("specs ng-hide")(0).getElementsByTagName("td")
Set CHRA2 = aIE.document.getElementsByClassName("specs")(4).getElementsByTagName("td")
If CHRA1(1).innertext <> CHRA2(1).innertext Then
Debug.Print CHRA2(1).innertext
End If
This HTML code has menu of targets and you need to select one target. One of these targets is ANY TARGET to continue process.
<tr id="mainForm:nav-panel-tab-set:0:trigger-selectTable:0" class=" iceRowSelMouseOver" tabindex="0" onmouseover="this.className=' iceRowSelMouseOver';" onmouseout="Ice.enableTxtSelection(document.body); this.className='iceDatTblRow1 selectable-rowRow1 iceRowSel'" onmousedown="return Ice.preventTextSelection(event);" ondblclick="Ice.registerDblClick(this);" onclick="Ice.registerClick(this,'mainForm:nav-panel-tab-set:0:trigger-selectTableclick_row','mainForm:nav-panel-tab-set:0:trigger-selectTableclick_count','0','mainForm',200,true,event,false,'mainForm:nav-panel-tab-set:0:trigger-selectTablesel_rows','');">
<td class="iceDatTblCol1 selectable-rowCol1" scope="row">
<a id="mainForm:nav-panel-tab-set:0:trigger-selectTable_idx_0" class="iceHdnLnk" onfocus="return Ice.tblRowFocus(this, false);" onblur="return Ice.tblRowBlur(this);" href="#">
<img alt="" src="/ice/xmlhttp/css/xp/css-images/spacer.gif"/>
</a>
<span id="mainForm:nav-panel-tab-set:0:trigger-selectTable:0:j_idt1417" class="iceOutTxt">ANY TARGET</span>
</td>
<td class="iceDatTblCol2 selectable-rowCol2">
<span id="mainForm:nav-panel-tab-set:0:trigger-selectTable:0:j_idt1419" class="iceOutTxt select-icon">»</span>
</td>
</tr>
How can I reach the ANY TARGET to click on >> to add using XPATH?
Extra Information:
The previous code is for sub window to add target. the main window code is:
<tr class="icePnlGrdRow1 settings-tableRow1">
<td id="mainForm:nav-panel-tab-set:0:j_idt1305-2-0" class="icePnlGrdCol1 settings-tableCol1">
<table id="mainForm:nav-panel-tab-set:0:j_idt1326" class="icePnlGrd settingsLabel">
<tbody>
<tr class="icePnlGrdRow1 settingsLabelRow1">
<td id="mainForm:nav-panel-tab-set:0:j_idt1326-0-0" class="icePnlGrdCol1 settingsLabelCol1">
<span id="mainForm:nav-panel-tab-set:0:j_idt1327" class="iceOutTxt label">Target</span>
</td>
</tr>
<tr class="icePnlGrdRow2 settingsLabelRow2">
<td id="mainForm:nav-panel-tab-set:0:j_idt1326-1-0" class="icePnlGrdCol1 settingsLabelCol1">
<span id="mainForm:nav-panel-tab-set:0:j_idt1328" class="iceOutTxt sidenote">Target or group</span>
</td>
</tr>
</tbody>
</table>
</td>
<td id="mainForm:nav-panel-tab-set:0:j_idt1305-2-1" class="icePnlGrdCol2 settings-tableCol2">
<table id="mainForm:nav-panel-tab-set:0:j_idt1329" class="icePnlGrd search">
<tbody>
<tr class="icePnlGrdRow1 searchRow1">
<td id="mainForm:nav-panel-tab-set:0:j_idt1329-0-0" class="icePnlGrdCol1 searchCol1">
<span id="mainForm:nav-panel-tab-set:0:j_idt1330" class="iceOutTxt"/>
</td>
<td id="mainForm:nav-panel-tab-set:0:j_idt1329-0-1" class="icePnlGrdCol2 searchCol2">
<input id="mainForm:nav-panel-tab-set:0:j_idt1331" class="iceCmdBtn" type="image" src="/ice/img/search-icon.png" onfocus="setFocus(this.id);" onclick="iceSubmitPartial(form, this, event);return false;" onblur="setFocus('');" name="mainForm:nav-panel-tab-set:0:j_idt1331"/>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
I used ID to click on the targets to open the sub window
//*[#id='mainForm:nav-panel-tab-set:0:j_idt1331']
However, I did not get any response to add any target to my main window either I used the solutions you mentioned.
You can reach the span containing "ANY TARGET":
//span[text() = "ANY TARGET"]
You can extend this to reach the span containing ">>" in the td immediately following the td that contains "ANY TARGET":
//td[span[text() = "ANY TARGET"]]/following-sibling::td[1]/span[text() = ">>"]
Try to focus on the first TD and then click on the Span element.
IWebElement td = browser_drive.FindElement(By.Id("mainForm:nav-panel-tab-set:0:trigger-selectTable:0")).FindElements(By.TagName("td"))[0];
IWebElement anytext = td.FindElement(By.Id("mainForm:nav-panel-tab-set:0:trigger-selectTable:0:j_idt1417"));
OpenQA.Selenium.Interactions.Actions act = new OpenQA.Selenium.Interactions.Actions(browser_drive);
act.MoveToElement(td).Click(anytext);
(Coded using C#, there must be an alternative. Pseudo code, not complied)
I'm using selenium 2 for a project which allows for date selection using jsf calendar wizard from myfaces (jsf 1.1). Can some one help me the steps for date selection. Thank you in advance.
Date of Birht field screenshot
Calendar popup screenshot
Corresponding html being generated
<div class="content">
<input id="firstApplicant2:ApplicantContent-DateOfBirth" name="firstApplicant2:ApplicantContent-DateOfBirth" type="text" maxlength="10" class="dateStyle" onfocus="selectText('null', 'firstApplicant2:ApplicantContent-DateOfBirth')" onclick="selectText('null', 'firstApplicant2:ApplicantContent-DateOfBirth')"><span id="firstApplicant2:ApplicantContent-DateOfBirthSpan"></span>
<div id="firstApplicant2:ApplicantContent-DateOfBirthSpan_calendarDiv" class="jscalendar-DB-div-style" style="visibility: hidden;">
<span id="firstApplicant2:ApplicantContent-DateOfBirthSpan"></span>
<table style="width:250px;" class="jscalendar-DB-table-style">
<tbody>
<tr class="jscalendar-DB-title-background-style">
<td>
<table style="width:248px;">
<tbody>
<tr>
<td class="jscalendar-DB-title-style">
<span><span class="jscalendar-DB-title-control-normal-style"> <img src="/webapp/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/13080856/calendar.HtmlCalendarRenderer/DB/left1.gif" width="10px" height="11px" style="border:0px;"> </span><span class="jscalendar-DB-title-control-normal-style"> <img src="/webapp/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/13080856/calendar.HtmlCalendarRenderer/DB/right1.gif" width="10px" height="11px" style="border:0px;"> </span> </span>
</td>
<td style="text-align:right;">
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td class="jscalendar-DB-body-style"></td>
</tr>
<tr class="jscalendar-DB-today-style">
<td class="jscalendar-DB-today-lbl-style">
<span>Today is <a class="jscalendar-DB-today-style" title="Go To Current Month" href="#">06/15/2011</a></span>
</td>
</tr>
</tbody>
</table>
</div>
<div id="firstApplicant2:ApplicantContent-DateOfBirthSpan_selectMonthDiv" class="jscalendar-DB-div-style" style="visibility: hidden;"></div>
<div id="firstApplicant2:ApplicantContent-DateOfBirthSpan_selectYearDiv" class="jscalendar-DB-div-style" style="visibility: hidden;"></div><script type="text/javascript">
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar=new org_apache_myfaces_PopupCalendar();
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar.initData.imgDir = "/webapp/faces/myFacesExtensionResource/org.apache.myfaces.renderkit.html.util.MyFacesResourceLoader/13080856/calendar.HtmlCalendarRenderer/DB/";
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar.initData.monthName = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar.initData.dayName = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar.initData.startAt = 0;
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar.dateFormatSymbols.weekdays = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar.dateFormatSymbols.shortWeekdays = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar.dateFormatSymbols.shortMonths = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar.dateFormatSymbols.months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar.dateFormatSymbols.eras = new Array("BC","AD");
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar.dateFormatSymbols.ampms = new Array("AM","PM");
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar.initData.todayDateFormat = "MM/dd/yyyy";
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar.initData.popupLeft = false;
firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar.init(document.getElementById('firstApplicant2:ApplicantContent-DateOfBirthSpan'));
</script><img src="/webapp/Images/upgrade/icon_calendar.jpg" style="vertical-align:bottom;" onclick="firstApplicant2_3AApplicantContent_2DDateOfBirthCalendarVar._popUpCalendar(this,document.getElementById('firstApplicant2:ApplicantContent-DateOfBirth'),'MM/dd/yyyy')">
</div>
Would it be acceptable to just update the input text field with the properly formatted date? Unless you are specifically testing that MyFaces widget, I think this should suffice.