troubleshooting Question

IE Automation - search source code for string

Avatar of paulpp
paulppFlag for United States of America asked on
Microsoft ExcelVisual Basic.NET
6 Comments2 Solutions294 ViewsLast Modified:
Hello,

I am trying to do a test whether a string on a webpage.  The problem is the text is encoded into a javascript function, so I cant do GetElementsBy....  Below is the source code I am looking at (I just attached the script the string is in), and a snipet of the line containg the string i need ("Parts not found !!".  Thank you.
str = str + "  <td class=\"LT_dataR\"><font color=red>Parts not found !!</font><a href='javascript:beforeOpenAlter(0);' onbeforeactivate='JAVASCRIPT:ignoreChange(true);'><img src='/gspn/images/en/Icon_search.gif' border=0 hspace=2 align='absmiddle'></a></td>";
      str = str + "</tr>";

Open in new window

function displayListData(){
    var str = "   <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"LT_deco\" id="+tid+">";
      str = str + "    <tr>";
      str = str + "     <td width=\"5%\" class=\"LT_head\"><input type=checkbox name=chk_all onClick=checkAll();></td>";
      str = str + "     <td width=\"12%\" class=\"LT_head\">Parts No <font color=#FF6600>*</font></td>";
      str = str + "     <td width=\"7%\" class=\"LT_head\">Qty <font color=#FF6600>*</font></td>";
 
      str = str + "     <td width=\"12%\" class=\"LT_head\">Shipping Method <font color=#FF6600>*</font></td>";
 
      str = str + "     <td width=\"12%\" class=\"LT_head\">Narda/Ticket No</td>";
 
      str = str + "     <td width=\"11%\" class=\"LT_head\">Service Date</td>";
      str = str + "     <td width=\"12%\" class=\"LT_head\">Reason</td>";
 
      str = str + "     <td class=\"LT_headR\">Result</td>";
      str = str + "    </tr>";
 
      str = str + "<tr>";
      str = str + "  <td align=center class=\"LT_data\"><input type=\"checkbox\" name=\"chk\"></td>";
 
      str = str + "  <td class=\"LT_data\"><input name=\"material\" type=\"text\" class=\"Fdefaultp\" size=20 maxlength=18 value=\"TEST\" onKeyUp=\"checkPartNo(this, "+0+")\" onChange=\"onChangePart(this)\"><a href=\"javascript:beforeOpen("+0+");\" onbeforeactivate=\"JAVASCRIPT:ignoreChange(true);\"><img src=\"/gspn/images/en/Icon_search.gif\" border=\"0\" hspace=\"2\" align=\"absmiddle\"></a></td>";
      str = str + "  <td class=\"LT_data\"><input name=\"quantity\" type=\"text\" class=\"F100p\" maxlength=6  style=\"text-align:right;\" value=\"14\" onChange=\"checknum(this);\"></td>";
 
 
 
 
      //str = str + "<td class=\"LT_data\"><input name=\"ship_method0\" type=\"radio\" class=\"FDefault\" value=\"S\" >Standard";
      //str = str + "<input name=\"ship_method0\" type=\"radio\" class=\"FDefault\" value=\"E\" >Expedited";
	  //str = str + "<input name=\"ship_method0\" type=\"radio\" class=\"FDefault\" value=\"N\" >No Cool</td><input type=hidden name=ship_method value=\"D1\">";
      str = str + "<td class=\"LT_data\"><select name=\"ship_method\" class=\"F70p\" style=\"width:100%\">";
                str = str + "<option value=\"\"></option>";
 
                str = str + "<option value=\"D8\" >Next Day</option>";
 
                str = str + "<option value=\"T1\" >2ND Day</option>";
 
                str = str + "<option value=\"D1\"  selected >Ground</option>";
 
                str = str + "</select></td>";
 
      str = str + "  <td class=\"LT_data\"><input name=\"refno\" type=\"text\" class=\"F100\" maxlength=10 value=\"\" ></td>";
 
      str = str + "  <td class=\"LT_data\"><input name=\"service_date\" value=\"\" type=\"text\" class=\"Fdefault\" style=\"text-align:left;ime-mode:disabled\" size=8 maxlength=10 onkeydown=\"checkDateFormat(this, window.event.keyCode,'down','MM/dd/yyyy')\" onkeyup=\"checkDateFormat(this, window.event.keyCode,'up','MM/dd/yyyy')\"><img src=\"/gspn/images/en/Icon_cal.gif\" hspace=\"2\" border=\"0\" align=\"absmiddle\" onclick=\"javascript:beforeOpenCalendar('FORM_ORDER.service_date', "+0+");\" style=\"cursor:hand;\"></td>";
      str = str + "  <td class=\"LT_data\"><input name=\"reason\" type=\"text\" class=\"F100\" maxlength=50 value=\"\" ></td>";
 
      str = str + "  <td class=\"LT_dataR\"><font color=red>Parts not found !!</font><a href='javascript:beforeOpenAlter(0);' onbeforeactivate='JAVASCRIPT:ignoreChange(true);'><img src='/gspn/images/en/Icon_search.gif' border=0 hspace=2 align='absmiddle'></a></td>";
      str = str + "</tr>";
 
      str = str + "</table>";
 
    document.all.sortDIV.innerHTML = str;
  }

Open in new window

ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros