XPATH Syntax - Katalon Studio - groovy

Hi,
I wanted to get the text from the webpage with Cucumber & Groovy in Katalon Studio. Please find the below Step Definition which has the xpath and below is the html code.
I wanted to read the below two lines from the page which can be referred in the html code also below. The number 596 varies each time i.e., dynamic.
Create Inquiry Tracking # 596
The inquiry for system tracking # 596 has been submitted successfully
Step Definition
inquiryt1 = WebUI.getText(findTestObject(By.xpath("//td[#class='pageTitle'][1]")))
Full Page HTML :
<html lang="en">
<head>
<title>Govt Inquiry</title>
<link rel="stylesheet" type="text/css" href="?appId=gmpinquiry&flName=/uitmpl/en/css/uitmpl.css" />
<link rel="stylesheet" type="text/css" href="?appId=gmpinquiry&flName=/gmpinquiry/css/gmpinquiry.css" />
<script type="text/javascript" src="?appId=gmpinquiry&flName=/uitmpl/js/other_scripts.js"></script>
<script type="text/javascript" src="?appId=gmpinquiry&flName=/uitmpl/js/freezingHeader.js"></script>
<script type="text/javascript" src="?appId=gmpinquiry&flName=/uitmpl/js/sortTable.js"></script>
<noscript>
<style>
table.mQH {display:block;}
</style>
</noscript>
<style id="antiClickjack">body{display:none !important;}</style>
<script type="text/javascript">
if (self === top) {
var antiClickjack = document.getElementById("antiClickjack");
antiClickjack.parentNode.removeChild(antiClickjack);
} else {
top.location = self.location;
}
</script>
</head>
<body onload="uitmpl_qhPageInit()">
<!-- Skip To Main Content should be the next element immediately after body element -->
<div class="skipnav">Skip to Main Content </div>
<script type="text/javascript" src="?appId=gmpinquiry&flName=/uitmpl/js/menu_script.js"></script>
<script type="text/javascript" src="?appId=gmpinquiry&flName=/uitmpl/js/application_settings.js"></script>
<script type="text/javascript" src="?appId=gmpinquiry&flName=/uitmpl/js/global_settings.js"></script>
<script language="javascript">
application.data = {
td_1: "Home",
td_2: "Govt Inquiry",
td_3: "Create Inquiry",
td_4: "Reports/Search",
td_5: "My Preference",
url_1: "javascript:OnGMPPortalSubmit(document.frmMenuScr, '')",
url_2: "javascript:OnMenuSubmit (document.frmMenuScr, 'homepage')",
url_3: "javascript:OnMenuDispatch (document.frmMenuScr, 'setupinquiry','create')",
url_4: "javascript:OnMenuSubmit (document.frmMenuScr, 'inqsubmenu')",
url_5: "javascript:OnMenuSubmit (document.frmMenuScr, 'userpref')"
};
global.data = {
//td_1: "AT&T BusinessDirect",
td_1: "Write Us",
td_2: "Help <span class=\"offscrn\"> - Opens a PDF Document for Help</span>",
td_3: "Close",
//td_3_1: "General Help",
//td_3_2: "Application Tutorial",
//td_3_3: "<span id=\"shHd\">Show</span> Quick Help",
//url_1: "javascript:bizDirect()",
url_1: "javascript:OnMenuSubmit(document.frmMenuScr, 'compose')",
url_2: "javascript:uitmpl_popUpReg(document.frmMenuScr.action + '?appId=' + document.frmMenuScr.appId.value + '&flName=' + document.frmMenuScr.context.value + '/help/Inquiry_UG.pdf')",
url_3: "javascript:window.close();"
//url_3_1: "javascript:uitmpl_popUpReg(document.frmMenuScr.action + \\'?appId=\\' + document.frmMenuScr.appId.value + \\'&flName=\\' + document.frmMenuScr.context.value + \\'/help/Inquiry_UG.pdf\\')",
//url_3_2: "#",
//url_3_3: "javascript:uitmpl_qhPageToggle()"
};
</script>
<script type="text/javascript" src="?appId=gmpinquiry&flName=/gmpinquiry/js/script.js"></script>
<!--************ uitmplbegin: tBAN ************-->
<!--****** begin:background graphic ******-->
<table width="100%" cellspacing="0" border="0" class="tBAN">
<tr>
<td><img src="?appId=gmpinquiry&flName=/uitmpl/en/img/swoosh.gif" width="650" height="69" alt="" border="0" /></td>
</tr>
</table>
<!--****** end:background graphic ******-->
<!--****** begin:logo and company title ******-->
<div class="logoCompany">
<table width="100%" cellspacing="0" border="0" class="tBAN">
<tr>
<td class="logo"><img src="?appId=gmpinquiry&flName=/uitmpl/en/img/attbizdirect.gif" width="291" height="63" alt="AT&T | Business Direct" border="0" /></td>
<td><!-- stretchable cell --></td>
<!-- max characters for company title: 72 w/ breaks (24 per line) -->
<td class="company">ATT Gov Sol Dev<br/>rm0013
<!-- Begin Skip Top Navigation -->
<!-- <div class="skipnav">Skip to Main Content</div> -->
<!-- End Skip Top Navigation --></td>
</tr>
</table>
</div>
<!--****** end:logo and company title ******-->
<!--****** begin:application title ******-->
<table cellspacing="0" border="0" class="appTitle">
<tr>
<td>View and Analyze Govt. Bills: Govt Inquiry</td>
</tr>
</table>
<!--****** end:application title ******-->
<!--************ uitmplend: tBAN ************-->
<!--************ uitmplbegin: tNAV ************-->
<div id="glbl">
<script language="JavaScript1.3">
<!--
uitmpl_list("global");
//-->
</script>
<noscript>
<div class="globalAcc">
<table class="global_main" cellspacing="0" border="0">
<tr>
<td class="global_main_spacer"> </td>
<td>AT&T BusinessDirect</td><td class="pipe">|</td><td>Write Us</td><td class="pipe">|</td><td>Help</td>
</tr>
</table>
</div>
</noscript>
</div>
<div id="app">
<script language="JavaScript1.3">
<!--
uitmpl_list("application");
//-->
</script>
<noscript>
<div class="applicationAcc"><table class="application_main" cellspacing="0" border="0">
<tr>
<td>Home</td>
<td class="pipe">|</td>
<td>Create/Update Dispute</td>
<td class="pipe">|</td>
<td>Reports/Search</td>
<td class="pipe">|</td>
<td>My Preference</td>
<td class="pipe">|</td>
<td>User Management</td>
</tr>
</table>
</div>
</noscript>
</div>
<!--************ uitmplend: tNAV ************-->
<form name="frmMenuScr" action="/servlet/GMPGate" method="get">
<input type="hidden" name="appId" value="gmpinquiry">
<input type="hidden" name="nextScr" value="userpref">
<input type="hidden" name="methodToCall" value=""/>
<input type="hidden" name="context" value="/gmpinquiry"/>
</form>
<!--***** begin:grid *****-->
<table width="100%" cellspacing="0" border="0" class="wrap">
<tr>
<td width="100%" class="grid">
<!-- InstanceBeginEditable name="PageHeader" -->
<!--************ uitmplbegin: tPH ************-->
<!--****** begin:titles ******-->
<table cellspacing="0" border="0" class="tPH">
<!--****** begin:page title ******-->
<tr>
<td class="pageTitle">Create Inquiry Tracking # 599</td>
</tr>
<!--****** end:page title ******-->
</table>
<!--****** end:titles ******-->
<!--************ uitmplend: tPH ************-->
<!-- InstanceEndEditable -->
</td>
<td width="182" class="grid"><img src="?appId=gmpinquiry&flName=/uitmpl/en/img/pixel.gif" width="182" height="1" alt="" border="0" /></td>
</tr>
</table>
<!--***** end:grid *****-->
<!--***** begin:grid *****-->
<table width="100%" cellspacing="0" border="0" class="wrap">
<tr>
<td width="100%" class="grid">
<!--- BeginOptional name="TaskConfirmation" --->
<!-- InstanceBeginEditable name="TaskConfirmation" -->
<!--************ uitmplbegin: mTC ************-->
<table cellspacing="0" cellpadding="2" border="0" class="mTC">
<tr class="msgConfirm">
<td> <img src="?appId=gmpinquiry&flName=/uitmpl/en/img/confirmation.gif" width="29" height="29"
border="0" alt="Confirmation." /></td><td>The inquiry for system tracking # 599 has been submitted successfully. </td>
</tr>
</table>
REASON FOR FAILED WITH THE SOLUTION
2019-06-26 18:40:10.049 ERROR c.k.k.c.c.keyword.CucumberReporter
- ❌ it should displays create inquiry pages FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.testobject.ObjectRepository.findTestObject()
is applicable for argument types: (org.openqa.selenium.By$ByXPath) values: [By.xpath: //td[#class='pageTitle'][1]]
Possible solutions: findTestObject(java.lang.String), findTestObject(java.lang.String, java.util.Map) at CreateInquiry001.it_should_displays_create_inquiry_page2(CreateInquiry001.groovy:369)
at ✽.it should displays create inquiry pages(C:/Users/vdavuluri2/Katalon Studio/Govt Inquiry/Include/features/Create Inquiry-001.feature:55)

Katalon's findTestObject() method is used for selecting an object from the object repository. It doesn't work with By class.
You can try with something like the following: create an object with the given Xpath and then use WebUI.getText() on it:
TestObject testObject = new TestObject().addProperty("xpath", ConditionType.EQUALS, "//td[#class='pageTitle'][1]")
WebUI.getText(testObject)

The element with class pageTitle looks unique so why not user
//td[#class='pageTitle']

Related

Layout for table using Bootstrap 4.2 not aligning as expected

In the process of moving from Bootstrap 3 to Bootstrap 4.2. I have a table inside a Ajax modal screen. Here is the code snippet:
<div class="card-body">
<div class="row">
<table class="table table-hover table-responsive-lg">
<thead>
<tr>
<td class="text-center col-sm-3"><strong>ACTIVITY</strong></td>
<td class="text-center col-sm-3"><strong>QTY</strong></td>
<td class="text-center col-sm-3"><strong>RATE</strong></td>
<td class="text-center col-sm-3"><strong>AMOUNT</strong></td>
</tr>
</thead>
<tbody>
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Closing Service" CssClass="form-con"></asp:Label></td>
<td class="text-center ">
<asp:TextBox ID="txtClosing_QTY" runat="server" CssClass="form-control"></asp:TextBox></td>
<td class="text-center ">
<asp:TextBox ID="txtClosing_Rate" runat="server" CssClass="form-control"></asp:TextBox></td>
<td class="text-center ">
<asp:TextBox ID="txtClosing_Total" runat="server" CssClass="form-control" ClientIDMode="Static"></asp:TextBox></td>
</tr>
</tbody>
</table>
</div>
</div>
In my system the columns showing QTY is too small to see the full number, even the number 1.
UPDATE
I changed the headers to col-sm-4 and the results are much the same. Here is an image of the outcome:
UPDATE 2
Suggested adding ROW class to the <tr> results in:
You can try adding class="row" to each tr instead of to the outside div
Example:
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.2.1/css/bootstrap.min.css">
</head>
<body>
<div style="width: 572px;">
<div class="card-body">
<div class="">
<table class="table table-hover table-responsive-lg">
<thead>
<tr class="row">
<td class="text-center col-sm-3"><strong>ACTIVITY</strong></td>
<td class="text-center col-sm-3"><strong>QTY</strong></td>
<td class="text-center col-sm-3"><strong>RATE</strong></td>
<td class="text-center col-sm-3"><strong>AMOUNT</strong></td>
</tr>
</thead>
<tbody>
<tr class="row">
<td class="col-sm-3 text-center "><asp:Label ID="Label1" runat="server" Text="Closing Service" CssClass="form-con"></asp:Label></td>
<td class="text-center col-sm-3">
<asp:TextBox ID="txtClosing_QTY" runat="server" CssClass="form-control"></asp:TextBox></td>
<td class="text-center col-sm-3">
<asp:TextBox ID="txtClosing_Rate" runat="server" CssClass="form-control"></asp:TextBox></td>
<td class="text-center col-sm-3">
<asp:TextBox ID="txtClosing_Total" runat="server" CssClass="form-control" ClientIDMode="Static"></asp:TextBox></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>
I wanted to close this out with a solution that worked for me. It was simple to fix. In the <thead> section of the table I removed the col-sm-3 tag and the table behaved as expected.
Thanks everyone!

Beautifulsoup find_all return empty list

I have the code below. I’m trying to understand what
re.compile('ctl(\d\d)_MainContent_ctl(\d\d)_DataDetails_ctl(\d\d)_trGBKItem')
does, and why
tstsoup.find_all('tr', tstgradebook_row_id)
returns an empty list.
I’ve provided a sample of tstsoup below where I’ve replaced some chunks with “…” so that I could post it. It comes from
tstsoup = BeautifulSoup(driver.page_source)
This code follows from code in the repo
https://github.com/AlbanyCompSci/aeries-api 
in the Gradebook.py file. I’m using it to try to write a script to login and pull my kids high school grades.
Code:
import pandas as pd
import numpy as np
import os
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
Options
options = Options()
chrome_options = Options()
options.add_argument('headless') #downlod Chrome driver.exe
driver = webdriver.Chrome(executable_path=os.path.abspath("chromedriver"), chrome_options=chrome_options)
import re, dateutil.parser
from bs4 import BeautifulSoup
# tstsoup
tstgradebook_row_id = {'id': re.compile('ctl(\d\d)_MainContent_ctl(\d\d)_DataDetails_ctl(\d\d)_trGBKItem')}
# tstgradebook_row_id
tstgradebook_rows = tstsoup.find_all('tr', tstgradebook_row_id)
tstgradebook_rows
output:
[]
sample data:
tstsoup
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html class="k-webkit k-webkit70" xmlns="http://www.w3.org/1999/xhtml"><head><title>
Gradebook Summary
</title><meta content="initial-scale=1" id="ctl00_viewport" name="viewport"/><link href="favicon.ico" rel="shortcut icon" type="image/x-icon"/><link href="favicon.ico" rel="icon" type="image/x-icon"/><link href="/ParentPortal/Content/AjaxControlToolkit/Styles/Bundle?v=nap9lZtcl5K2gETjyyPCBXbWNbj8GlEheXK38ePUqDw1" rel="stylesheet"/>
<link href="StyleSheets/aeries.common.min.css?v=20160413" rel="stylesheet" type="text/css"/><link href="StyleSheets/aeries.default.min.css?v=20160413" rel="stylesheet" type="text/css"/><link href="StyleSheets/aeries-responsive.css" rel="stylesheet" type="text/css"/><link href="StyleSheets/Sofia.css" rel="stylesheet" type="text/css"/><link href="StyleSheets/GeneralLight.css" id="ctl00_BaseCSS" rel="stylesheet" type="text/css"/><link href="StyleSheets/calendar-stylesheet.css" rel="stylesheet" type="text/css"/><link href="KendoUI/kendo.common.min.css?v=2017.1.118" rel="stylesheet" type="text/css"/><link href="KendoUI/kendo.rtl.min.css?v=2017.1.118" rel="stylesheet" type="text/css"/><link href="KendoUI/kendo.bootstrap.min.css?v=2017.1.118" rel="stylesheet" type="text/css"/><link href="StyleSheets/bootstrap/bootstrap.css?v=2017.1.118" rel="stylesheet" type="text/css"/><link href="StyleSheets/bootstrap/bootstrap-tour.min.css?v=20170522" rel="stylesheet" type="text/css"/><link href="KendoUI/kendo.dataviz.min.css?v=2017.1.118" rel="stylesheet" type="text/css"/><link href="KendoUI/kendo.dataviz.default.min.css?v=2017.1.118" rel="stylesheet" type="text/css"/><link href="StyleSheets/font-awesome/font-awesome.min.css" rel="stylesheet" type="text/css"/><link href="StyleSheets/aeries-kendo-win.min.css" rel="stylesheet" type="text/css"/><link href="StyleSheets/CheckBoxes.min.css?vsn=20150929" rel="stylesheet" type="text/css"/><link href="StyleSheets/aeries-master.min.css?vsn=20160301" rel="stylesheet" type="text/css"/>
<script src="ClientScripts/ControlPositions.js?vsn=20170822" type="text/javascript"></script>
<script src="ClientScripts/ExpandOut.js" type="text/javascript"></script>
<script src="ClientScripts/XMLCommunications.js" type="text/javascript"></script>
<script src="ClientScripts/xmldom.js" type="text/javascript"></script>
<script src="Scripts/require/TimeOut.js?vsn=20180509" type="text/javascript"></script>
<script src="ClientScripts/calendar.js?vsn20141202" type="text/javascript"></script>
<script src="ClientScripts/EmailStuff.js?vsn=20160428" type="text/javascript"></script>
<script src="ClientScripts/jquery.min.js?v=1.12.3" type="text/javascript"></script>
<script src="ClientScripts/jquery.validate.min.js" type="text/javascript"></script>
<script src="ClientScripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
<script src="ClientScripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
<script src="KendoUI/kendo.all.min.js?v=2017.1.118" type="text/javascript"></script>
<script src="KendoUI/kendo.aspnetmvc.min.js?v=2017.1.118" type="text/javascript"></script>
<script src="Scripts/velocity.min.js" type="text/javascript"></script>
<script src="ClientScripts/General.js?vsn=20180824" type="text/javascript"></script>
<script src="ClientScripts/StudentBackpack.js?vsn=20161208" type="text/javascript"></script>
<script type="text/javascript">window.defaultStatus="Welcome to Aeries";</script>
<script src="ClientScripts/aeries-kendo-windows-1.0.4.js?vsn=20160401" type="text/javascript"></script>
<script src="ClientScripts/UserOptions.js?vsn=20160504" type="text/javascript"></script>
<script src="ClientScripts/aeries-pagination.js?vsn=20160309" type="text/javascript"></script>
<script src="Scripts/bootstrap.min.js" type="text/javascript"></script>
<script src="ClientScripts/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="Scripts/bootstrap-tour.min.js?v=20170522" type="text/javascript"></script>
<script src="ClientScripts/Tours.js?v=20180227" type="text/javascript"></script>
<script src="Tracking.vbhtml?636756623367579132" type="text/javascript"></script>
<script src="ClientScripts/demo-feedback_js.js" type="text/javascript"></script>
<link href="ClientScripts/demo-feedback_css.css" rel="stylesheet" type="text/css"/>
<!-- PM - disable tracking for now.
<link rel='stylesheet' type='text/css' href='//aeriestools.tech/screenshot-feedback/feedback.css?636756623367579132' />
<script type='text/javascript' src='//aeriestools.tech/tracking.js?636756623367579132'></script>
-->
<script type="text/javascript">
$(document).ready(function () {
if (kendo.support.mobileOS) {
//GeneralFunctions.IsDemoServer(CheckForMobileVersion_IsDemoServer_Complete);
}
...
</script>
<script src="GeneralFunctions.asmx/js" type="text/javascript"></script>
<script src="SecurityFunctions.asmx/js" type="text/javascript"></script>
<div class="aspNetHidden">
<input id="__VIEWSTATEGENERATOR" name="__VIEWSTATEGENERATOR" type="hidden" value="868F4997"/>
</div>
<script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ctl00$TheMasterScriptManager', 'aspnetForm', ['tctl00$MainContent$subStuTopAll$subQuickCON$subQuickCON_UpdatePanel','','tctl00$MainContent$subGBS$upPrint',''], [], [], 90, 'ctl00');
//]]>
</script>
<div class="view" data-root-url="https://abip.fsusd.org/ParentPortal/" data-school-code="520" style="height: 100%">
<table class="full NoPadding a-expand">
<tbody><tr id="ctl00_trTop">
<td class="ac" valign="top">
<nav class="navbar navbar-l" id="navparent">
<div class="container-fluid" id="nav-container">
<div class="navbar-header" style="float:left;">
<div class="pull-left">
<div class="sidebar-logo-a">
<a href="Default.aspx" title="Aeries Home">
<img alt="Aeries" onerror="this.src='images/aeries-logo-a.png'; this.onerror=null;" src="images/aeries-logo-a.png" title="Aeries Student Information System"/>
</a>
</div>
</div>
<ul class="nav navbar-nav navbar-left" id="nav-school-settings">
<li class="school-year-nav dropdown-submenu aeries-background-green-light" id="ctl00_schoolYearNav">
<span class="school-year-nolink-nav-text NoWrap" id="ctl00_lblSchoolYear">2018-2019</span>
</li>
<li class="dropdown-submenu" id="school-dropdown-wrapper">
<span class="school-name-nolink-nav-text NoWrap" id="ctl00_lblSchoolName" title="School 520">Rodriguez High</span>
</li>
<li>
<input class="MasterSC" id="ctl00_SC" name="ctl00$SC" type="hidden" value="520"/>
<input class="MasterSN" id="ctl00_SN" name="ctl00$SN" type="hidden" value="5272"/>
<input class="MasterPID" id="ctl00_PID" name="ctl00$PID" type="hidden" value="154138"/>
</li>
</ul>
</div>
<ul class="nav navbar-nav navbar-right" id="nav-settings">
<li class="dropdown-submenu nav-buttons">
<a class="dropdown-toggle expandable" data-toggle="dropdown" href="#" id="nav-account-dropdown-icon" title="Settings">
<span class="normalmode">
<span id="ctl00_lblWelcomeName">jennscorner#gmail.com</span>
<span class="icon-collapsed"></span>
</span>
<span class="tinymode">
<span class="k-icon k-i-custom" id="collapsed-settings-icon"></span>
</span>
</a>
<ul class="dropdown-menu SubTab forceRight" id="nav-account-dropdown" style="margin-top:0; padding-top:0;">
<li class="zebra" id="mobileTestdrive" style="display: none;"></li>
<li class="zebra" css="ContextMenuItem" id="ctl00_liParentNotification">
Parent Notification Preferences
</li>
<li class="zebra">
<a css="ContextMenuItem" href="/ParentPortal/ChangePassword.aspx" id="aChangePWD">Change Password</a>
</li>
<li class="zebra">
<a css="ContextMenuItem" href="/ParentPortal/ChangeEmail.aspx" id="aChangeEM">Change Email</a>
</li>
<li class="zebra">
<a css="ContextMenuItem" href="/ParentPortal/AddNewStudentToParent.aspx" id="aAddSTU">Add New Student To Your Account</a>
</li>
<li class="zebra">
<a css="ContextMenuItem" href="/ParentPortal/LogOut.aspx" id="aLogOut">Log Out</a>
</li>
</ul>
</li>
</ul>
</div>
</nav>
<div id="ctl00_ParNav_ParNav"><table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr><td align="left" class="raised "><table border="0" cellpadding="0" cellspacing="0" class="menutable"><tbody><tr valign="top"><td><div class="Top_Parent" id="Top_1"><a aria-haspopup="true" class="topdynamicmenu" href="Default.aspx" id="Home" name="Home" onclick="return true" target="">Home</a></div></td><td><div class="Top_Parent" id="Top_2"><a aria-haspopup="true" class="topdynamicmenu" href="javascript:void(0);" id="Student Info" name="Student Info" onclick="return true" target="">Student Info</a><div class="SubTab" id="Sub_2"><a class="zebra" href="StudentProfile.aspx" id="Profile" name="Profile">Profile</a><a class="zebra" href="Students.aspx" id="Demographics" name="Demographics">Demographics</a><a class="zebra" href="EmergencyContacts.aspx" id="Contacts" name="Contacts">Contacts</a><a class="zebra" href="ClassesOld.aspx" id="Classes" name="Classes">Classes</a><a class="zebra" href="Fees.aspx" id="Fees and Fines" name="Fees and Fines">Fees and Fines</a><a class="zebra" href="WorkPermit.aspx" id="Work Permit" name="Work Permit">Work Permit</a></div></div></td><td><div class="Top_Parent" id="Top_3"><a aria-haspopup="true" class="topdynamicmenu" href="javascript:void(0);" id="Attendance" name="Attendance" onclick="return true" target="">Attendance</a><div class="SubTab" id="Sub_3"><a class="zebra" href="Attendance.aspx" id="Attendance" name="Attendance">Attendance</a></div></div></td><td><div class="Top_Parent" id="Top_4"><a aria-haspopup="true" class="visitedtopmenu" href="javascript:void(0);" id="Grades" name="Grades" onclick="return true" target="">Grades</a><div class="SubTab" id="Sub_4"><a class="visitedsubmenu" href="GradebookSummary.aspx" id="Gradebook" name="Gradebook">Gradebook</a><a class="zebra" href="GradebookDetails.aspx" id="Gradebook Details" name="Gradebook Details">Gradebook Details</a><a class="zebra" href="StudentReportCardHistory.aspx" id="Report Card History" name="Report Card History">Report Card History</a><a class="zebra" href="Grades.aspx" id="Grades" name="Grades">Grades</a><a class="zebra" href="GraduationRequirements.aspx" id="Graduation Status" name="Graduation Status">Graduation Status</a><a class="zebra" href="Transcripts.aspx" id="Transcripts <span class='metadata' style='display: none;'>History</span>" name="Transcripts <span class='metadata' style='display: none;'>History</span>">Transcripts <span class="metadata" style="display: none;">History</span></a><a class="zebra" href="CollegeEntrance.aspx" id="College Entrance Requirements" name="College Entrance Requirements">College Entrance Requirements</a><a class="zebra" href="StudentStandardsBasedProgress.aspx" id="Standards Based Progress Dashboard" name="Standards Based Progress Dashboard">Standards Based Progress Dashboard</a></div></div></td><td><div class="Top_Parent" id="Top_5"><a aria-haspopup="true" class="topdynamicmenu" href="javascript:void(0);" id="Medical" name="Medical" onclick="return true" target="">Medical</a><div class="SubTab" id="Sub_5"><a class="zebra" href="MedicalHistory.aspx" id="Medical History" name="Medical History">Medical History</a><a class="zebra" href="Immunizations.aspx" id="Immunizations" name="Immunizations">Immunizations</a></div></div></td><td><div class="Top_Parent" id="Top_6"><a aria-haspopup="true" class="topdynamicmenu" href="javascript:void(0);" id="Test Scores" name="Test Scores" onclick="return true" target="">Test Scores</a><div class="SubTab" id="Sub_6"><a class="zebra" href="TestDetails.aspx" id="Test Details" name="Test Details">Test Details</a><a class="zebra" href="TestScores.aspx" id="Test Scores" name="Test Scores">Test Scores</a><a class="zebra" href="CollegeTestScores.aspx" id="College Entrance Tests" name="College Entrance Tests">College Entrance Tests</a><a class="zebra" href="PhysicalFitnessTestResults.aspx" id="Physical Fitness Test Results" name="Physical Fitness Test Results">Physical Fitness Test Results</a></div></div></td><td><div class="Top_Parent" id="Top_7"><a aria-haspopup="true" class="topdynamicmenu" href="javascript:void(0);" id="Change Student" name="Change Student" onclick="return true" target="">Change Student</a><div class="SubTab" id="Sub_7"><a class="zebra" href="ChangeStudent.aspx?cache=10%2f20%2f2018+12%3a58%3a56+PM&SC=520&SN=6703&ReturnPage=GradebookSummary.aspx&name=520_6703&id=520_6703" id="Anderson, Brett E - Grd 9 - Rodriguez High" name="Anderson, Brett E - Grd 9 - Rodriguez High" target="_blank">Anderson, Brett E - Grd 9 - Rodriguez High</a><a class="zebra" href="ChangeStudent.aspx?cache=10%2f20%2f2018+12%3a58%3a56+PM&SC=520&SN=5272&ReturnPage=GradebookSummary.aspx&name=520_5272&id=520_5272" id="Anderson, Drew J - Grd 11 - Rodriguez High" name="Anderson, Drew J - Grd 11 - Rodriguez High" target="_blank">Anderson, Drew J - Grd 11 - Rodriguez High</a><a class="zebra" href="AddNewStudentToParent.aspx" id="Add New Student To Your Account" name="Add New Student To Your Account">Add New Student To Your Account</a></div></div></td></tr></tbody></table></td></tr></tbody></table></div>
</td>
</tr>
<tr style="background-color:#F5F5F5; height: 525px; min-height:525px;"><td class="al" style="padding: 5px 5px 5px 5px; min-height:525px;" valign="top">
<div style="width:100%;"><span class="RedText" id="ctl00_lblAlert"></span></div>
<div class="page-head">
<div class="page-title">
<span class="lblPageTitle" id="ctl00_MainContent_subPageHead_lblPageTitle">Gradebook Summary</span>
</div>
<div class="page-options">
<span class="fa fa-print fa-2x page-option-default" id="print-submit" title="Print"></span>
<div class="hide">
<span id="favorite-submit" title="Favorite This Page"><span class="favorite-icon fa fa-star-o fa-2x page-option-default" id="ctl00_MainContent_subPageHead_FavoriteIcon"></span></span>
</div>
</div>
</div>
<input id="ctl00_MainContent_subPageHead_RedFlagValue" name="ctl00$MainContent$subPageHead$RedFlagValue" type="hidden"/>
<div id="StartTourWelcome" style="display: none;">
<div style="padding: 5px 0 20px 0;">
Would you like to take a tour of this page and its features?
</div>
<a class="k-button" href="#" id="StartTourWelcomeNo">No</a>
<div style="float:right">
<a class="k-button-primary" href="#" id="StartTourWelcomeYes">Yes</a>
</div>
</div>
<script>
...
<td class="Data NoWrap ac">Y</td>
<td class="Data NoWrap ac"></td>
</tr>
<tr class="zebratr">
<td class="Data ac aeries-dark-red"><b> </b></td>
<td class="Data NoWrap">
Sean Anderson
</td>
<td class="Data NoWrap">(707) 640-9807</td>
<td class="Data NoWrap"></td>
<td class="Data NoWrap"></td>
<td class="Data NoWrap">
Family Member
</td>
<td class="Data NoWrap ac"></td>
<td class="Data NoWrap ac"></td>
</tr>
<tr class="zebratr">
<td class="Data ac aeries-dark-red"><b> </b></td>
<td class="Data NoWrap">
Travis Shields
</td>
<td class="Data NoWrap"></td>
<td class="Data NoWrap"></td>
<td class="Data NoWrap">(415) 490-8826</td>
<td class="Data NoWrap">
Aunt/Uncle
</td>
<td class="Data NoWrap ac"></td>
<td class="Data NoWrap ac"></td>
</tr>
<tr class="zebratr">
<td class="Data ac aeries-dark-red"><b> </b></td>
<td class="Data NoWrap">
Dr. Finklestein
</td>
<td class="Data NoWrap">(707) 641-1900</td>
<td class="Data NoWrap"></td>
<td class="Data NoWrap"></td>
<td class="Data NoWrap">
Doctor/Health Plan
</td>
<td class="Data NoWrap ac"></td>
<td class="Data NoWrap ac"></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<script type="text/javascript">
$(document).ready(function () {
$("div[id$='_pnlQuickCON'] .widget-title").html($("div[id$='_pnlQuickCON'] .widget-title").html() + " For " + $(".lblName").text());
});
</script>
</div>
</div>
</div>
</div></div><div class="modalBackground" data-act-control-type="modalPopupBackground" id="QuickCONBehavior_backgroundElement" style="display: none; position: fixed; left: 0px; top: 0px; z-index: 10000;"></div></td></tr>
<tr><td>
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tbody><tr>
<td class="al" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #000000;">Aeries Version <span id="ctl00_lblVersion">8.18.9.28</span></td>
<td class="ar" style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #000000;"><span id="ctl00_lblCopyright">Copyright © 1995-2018 Aeries Software. All Rights Reserved.</span></td>
</tr></tbody></table>
</td></tr>
</tbody></table>
</div>
<a class="hide" href="javascript:__doPostBack('ctl00$btnPrevious','')" id="ctl00_btnPrevious"></a>
<a class="hide" href="javascript:__doPostBack('ctl00$btnNext','')" id="ctl00_btnNext"></a>
<script language="javascript"> var timeoutIsParent = true; var global_SessionTimer; var global_WarningTimer; var global_SessionTimeout = 1200000; var global_WarningTimeout = 900000; initSessionTimer(1200000,900000);</script>
<script type="text/javascript">
//<![CDATA[
function PrintReport(){__doPostBack('ctl00$MainContent$subGBS$btnPrint','');}Sys.Application.add_init(function() {
$create(Sys.Extended.UI.ModalPopupBehavior, {"backgroundCssClass":"modalBackground","dropShadow":true,"dynamicServicePath":"/ParentPortal/GradebookSummary.aspx","id":"QuickCONBehavior","popupControlID":"ctl00_MainContent_subStuTopAll_pnlQuickCON"}, null, null, $get("ctl00_MainContent_subStuTopAll_btnShowQuickCON"));
});
Sys.Application.add_init(function() {
$create(Sys.Extended.UI.ModalPopupBehavior, {"backgroundCssClass":"modalBackground","cancelControlID":"ctl00_MainContent_subGBS_imgCloseTrendGraph","dynamicServicePath":"/ParentPortal/GradebookSummary.aspx","id":"ShowTrendGraph","popupControlID":"ctl00_MainContent_subGBS_pnlTrendGraph"}, null, null, $get("ctl00_MainContent_subGBS_btnShowTrendPopup"));
});
//]]>
</script>
</form>
<script type="text/javascript">
// remove the mobile portal link on desktop browsers
if (!kendo.support.mobileOS) {
$('#mobileTestdrive').hide();
if ($get("mobileTestdrive")) { $get("mobileTestdrive").innerHTML = ""; }
} else {
$('#mobileTestdrive').show();
}
window.masterSC = $('.MasterSC').val();
window.masterSN = $('.MasterSN').val();
window.masterID = $('.MasterPID').val();
</script>
<script type="text/javascript">
$(document).ready(function() {
window.masterSC = $('.MasterSC').val();
window.masterSN = $('.MasterSN').val();
window.masterID = $('.MasterPID').val();
});
</script>
<div class="k-widget k-window" data-role="draggable" style="padding-top: 35px; min-width: 90px; min-height: 50px; width: 400px; height: 235px; display: none;"><div class="k-window-titlebar k-header" style="margin-top: -35px;"> <span class="k-window-title" id="kendoCommonPopup_wnd_title"></span><div class="k-window-actions"><a aria-label="Close" class="k-button k-bare k-button-icon k-window-action" href="#" role="button"><span class="k-icon k-i-close"></span></a></div></div><div aria-labelledby="kendoCommonPopup_wnd_title" class="k-window-content k-content" data-role="window" id="kendoCommonPopup" role="dialog" tabindex="0"></div><div class="k-resize-handle k-resize-n"></div><div class="k-resize-handle k-resize-e"></div><div class="k-resize-handle k-resize-s"></div><div class="k-resize-handle k-resize-w"></div><div class="k-resize-handle k-resize-se"></div><div class="k-resize-handle k-resize-sw"></div><div class="k-resize-handle k-resize-ne"></div><div class="k-resize-handle k-resize-nw"></div></div></body></html>
I figured out the pattern of the id I was looking for had changed. It now looks like 'ctl(\d\d)_MainContent_subGBS_DataDetails_ctl(\d\d)_trGBKItem', and if I use that pattern I get the right chunks of source code.

How to pull a text from a table but the table has the same name as other tables? VBA, excel

I've made a code that would go to a website and pull their investment criteria. But I only need one cell in that table and the table class name is the same for multiple tables.
I need to get the EBITDA, which is on the table class = cTblListBody
Here's my code thus far:
Sub SearchBot()
Dim objIE As InternetExplorer
Dim aEle As HTMLLinkElement
Dim y As Integer
Dim result As String
Dim TR As Object, TD As Object
Dim tbl As Object, obj_tbl As Object
Set objIE = New InternetExplorer
objIE.Visible = True
objIE.navigate "https://website.com"
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
objIE.document.getElementById("SearchTopBar").Value = _
Sheets("Sheet2").Range("A2").Value
Set oNode = objIE.document.getElementsByClassName("iPadHack tmbsearchright")
(0)
oNode.Click
Do While objIE.Busy = True Or objIE.readyState <> 4: DoEvents: Loop
b = 2
Dim tblEle
Set tblEle = objIE.document.getElementsByClassName("cTblListBody")(5)
Sheets("Sheet2").Range("B" & b).Value = tblEle.innerText
Debug.Print tblEle.innerText
b = b + 1
Next
objIE.Quit 'close the browser
End Sub
Full html code:
html
<head id="ctl02_headcontrol">
<body>
<div id="gcontainer" style="z-index:200000" onmouseout="calendarTimeout();"
onmouseover="if (timeoutId) clearTimeout(timeoutId);"></div>
<style>
<script type="text/javascript">
<img id="_jsVersionedShim" title=""
src="https://w3.ciqimg.com/CIQDOTNET/images/shim.gif?urwvid=3502569" alt=""
style="display:none;">
<script type="text/javascript">
<link title="IQ" rel="search"
type="application/opensearchdescription+xml"
href="/ciqdotnet/search/autocompleteprovidergenerator.axd">
<link rel="stylesheet" type="text/css"
href="/CIQDOTNET/library/Combined/CIQHeader.css">
<style>
<div id="topBanner" style="width: 100%; height: 69px;">
<table style="height: 100%" width="100%" cellspacing="0" cellpadding="0"
border="0">
<tbody>
<tr valign="bottom">
<tr id="bodyrow" style="height:100%;" valign="top">
<td id="ll_leftBorder_mid">
<td id="ll_cont" class="ll_cont_ex">
<td id="leftPageBorder" style="width: 10px;">
<td style="width: 100%;">
<div id="contentArea">
<script type="text/javascript">
<script type="text/javascript">
<div id="UpdateProgressDiv" style="visibility:hidden;"></div>
<script type="text/javascript"
src="/CIQDotNet/Charting/Library/highstock.js">
<script type="text/javascript"
src="/CIQDotNet/CreditAnalytics/CIQCharts/themes/light.js">
<script type="text/javascript"
src="/CIQDotNet/CreditAnalytics/CIQCharts/lib/util.js">
<script type="text/javascript"
src="/CIQDotNet/CreditAnalytics/CIQCharts/CIQCharts.js">
<style type="text/css">
<script type="text/javascript"
src="/CIQDotNet/News/library/NewsAndBlogs.js">
<script type="text/javascript">
<form id="frmMain" method="post" action="./company.aspx?companyId=30995038">
<div class="aspNetHidden">
<script type="text/javascript">
<script src="/CIQDotNet/WebResource.axd?d=nZzj3YZngGCPUXbcooPdPCjPJSuAIp
DU_l-5lPsFAlauINflCZuBPW8NfeQFL1nsY13w4LY1&t=635802961220000000"
type="text/javascript">
<script language="javascript">
<script src="/CIQDotNet/LeftLinks/LeftLinksContent.aspx
leftLinksHashKey=e1HX3w3nPsHpyHn6IEXdcA%3d%3d&urwvid=3502569"
type="text/javascript">
<script type="text/javascript">
<script src="/CIQDotNet/library/CIQDotNet/Web/functional.js"
type="text/javascript">
<script type="text/javascript">
<script src="/CIQDotNet/ScriptResource.axd
d=BQRO1XhoYSDCQiunG6j3W6BEdFJUaLhgrsqvXzeFZkJH6K5tgvKMDrgFuDHlO
1ymPMZRaduCK4dNstqE6toFrC4k8xUF9d5645" type="text/javascript">
<script src="/CIQDotNet/ScriptResource.axd?
<script src="Company/BubbleChart.asmx/js" type="text/javascript">
<script type="text/javascript">
<script src="/CIQDotNet/Research/Services/ResearchService.asmx/js"
type="text/javascript">
<div class="aspNetHidden">
<script type="text/javascript">
<div id="CompanyHeaderInfo" class="cPageTitle" style="margin-bottom:38px;">
<table class="cTblListBody" style="width:100%;" border="1">
<div style="width:100%;">
<div style="width:100%;">
<div style="width:100%;">
<div style="width:100%;">
<br class="tableSpacer">
<table style="width:100%;border-collapse:collapse;" cellspacing="0"
cellpadding="0">
<tbody>
<tr>
<td>
<table class="cTblHeaderBG" style="width:100%;">
<table class="cTblListBody" style="width:100%;border-collapse:collapse;"
cellspacing="0" cellpadding="2">
<a name="#ctl22$ctl09"></a>
<table class="cTblListBody" rules="all" cellspacing="1" cellpadding="2"
bordercolor="#d8dde1" border="1">
<tbody>
<tr class="cColHeaderBG">
<tr>
<tr style="background-color:#F9F9F9;">
<tr>
<tr style="background-color:#F9F9F9;">
<td>EBITDA</td>
<td style="width:50px;" align="right">
<span></span>
-
</td>
<td style="width:50px;" align="right">
<td style="width:50px;" align="right">
<td style="width:50px;" align="right">
</tr>
<tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div style="width:100%;">
<div style="width:100%;">
<div style="width:100%;">
<div style="width:100%;">
<br class="tableSpacer">
<div> </div>
<script type="text/javascript">
<script type="text/javascript">
<script language="JavaScript">
<script language="JavaScript">
<script language="JavaScript">
<script type="text/javascript">
</form>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
</div>
</td>
<td id="rightPageBorder" style="width: 10px;">
</tr>
<tr valign="top">
</tbody>
</table>
<div id="btmFooter" class="ftrBG">
<a id="_hotkey1" accesskey="1" tabindex="-1" onclick="HotKey(1);"
onfocus="HotKeyIE(1)" href="javascript:void(0);"
style="position:fixed;top:0;left:0"></a>
<a id="_hotkey2" accesskey="2" tabindex="-1" onclick="HotKey(2);"
onfocus="HotKeyIE(2)" href="javascript:void(0);"
style="position:fixed;top:1;left:0"></a>
<a id="_hotkey3" accesskey="3" tabindex="-1" onclick="HotKey(3);"
onfocus="HotKeyIE(3)" href="javascript:void(0);"
style="position:fixed;top:2;left:0"></a>
<a id="_hotkey4" accesskey="4" tabindex="-1" onclick="HotKey(4);"
onfocus="HotKeyIE(4)" href="javascript:void(0);"\
style="position:fixed;top:3;left:0"></a>
<a id="_hotkey5" accesskey="5" tabindex="-1" onclick="HotKey(5);"
onfocus="HotKeyIE(5)" href="javascript:void(0);"
style="position:fixed;top:4;left:0"></a>
<a id="_hotkey6" accesskey="6" tabindex="-1" onclick="HotKey(6);"
onfocus="HotKeyIE(6)" href="javascript:void(0);"
style="position:fixed;top:5;left:0"></a>
<a id="_hotkey7" accesskey="7" tabindex="-1" onclick="HotKey(7);"
onfocus="HotKeyIE(7)" href="javascript:void(0);"
style="position:fixed;top:6;left:0"></a>
<a id="_hotkey8" accesskey="8" tabindex="-1" onclick="HotKey(8);"
onfocus="HotKeyIE(8)" href="javascript:void(0);"
style="position:fixed;top:7;left:0"></a>
<a id="_hotkey9" accesskey="9" tabindex="-1" onclick="HotKey(9);"
onfocus="HotKeyIE(9)" href="javascript:void(0);"
style="position:fixed;top:8;left:0"></a>
<a id="_hotkey0" accesskey="0" tabindex="-1" onclick="HotKey(0);"
onfocus="HotKeyIE(0)" href="javascript:void(0);"
style="position:fixed;top:9;left:0"></a>
</body>
</html>
You need to get the third instance of that ClassName, so, instead of looping the collection of matching ClassName elements, try this:
Dim tblEle
Set tblEle = objIE.document.getElementsByClassName("cTblListBody")(2)
Then, I think you can you get the cell value from that element.
Also note:
You use variable i but I don't see that declared anywhere in code: For Each aEle In objIE.document.getElementsByClassName("cTblListBody").Rows.
(i).Cells(1).innerText. Should this be b instead of i?

Frameset in web app - one of the frames not displaying, but only in IE

We have an old legacy VBScript app that's been running on IIS 6 for many years, and we are now migrating it from Windows Server 2003 to Windows Server 2012 R2. As far as the markup being valid, I'm sure there are many, many issues, but since it's an intranet app, I cannot really run it through a WC3 validator or anything like that.
Anyway, in moving it to our test and production 2012 boxes, one machine serves up the app just fine, and the other one fine, EXCEPT one of the frames on the "home" page will display for a bit while waiting for the response to complete, then once the page has been loaded, the content in that frame disappears, leaving behind a generic "content cannot be displayed message." The logs are proving to be pretty generic with the error codes, and I've compared every IIS setting between the two servers; all settings match. I've checked the installed features on both servers, all match. All the HTML and .asp files are exactly the same. The global.asa files match except for prod/test specific settings, and with any other browser besides IE, both the test and prod pages are served up successfully.
I've tried Compatibility Mode - same result. I know frames are evil, but I just don't know what would cause the code from one of these servers to fail and the other to load fine in IE, but as I said, both servers load the content fine in any other browser.
Here's the Default.htm file (the "home" page). The "TitleFrame.asp" file is the one that's failing to load once the response finishes:
<HTML>
<HEAD>
<TITLE>Page Title</TITLE>
</HEAD>
<FRAMESET ROWS="82,*,20" BORDER="0" FRAMEBORDER="0">
<FRAME NAME="header" TITLE="Portal Header" SRC="TitleFrame.Asp" FRAMEBORDER="0" MARGINHEIGHT="0" SCROLLING="no">
<FRAME NAME="main" TITLE="Main Content" SRC="Home.Asp" FRAMEBORDER="0" MARGINHEIGHT="0">
<FRAME NAME="footer" TITLE="Foot Notes" SRC="FootFrame.Asp" FRAMEBORDER="0" MARGINHEIGHT="0" SCROLLING="no">
</FRAMESET>
</HTML>
and here's the TitleFrame.asp code. Essentially it displays the current database name, authorized user, a logout link, and if a user has been authorized in the global.asa, extra menu items are displayed:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html">
<META HTTP-EQUIV="refresh" CONTENT="600">
<script language='javascript' src='Included_Files/PT_PIAHDRSCRIPT_ENG_empty_1.js'></script>
<script language='javascript' src='Included_Files/PT_ISCROSSDOMAIN_ENG_empty_1.js'></script>
</head>
<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0 bgcolor=#ffffff>
<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>
<td rowspan=3 width=96>
<img src=Included_Files/MyCompany2.gif width=125 height=30 alt="MyCompany Logo" hspace=20></td>
<td width=142 class=globeBar>
<img src=Included_Files/PT_PORTAL_BEIGE_GRAD_ENG_1.JPG width=142 height=36></td>
<td align=right width=90% class=globeBar>
<img src=Included_Files/PT_PORTAL_GLOBE_ENG_1.JPG width=118 height=36></td>
</tr>
<tr>
<td class=searchBar width=142>
<img src=Included_Files/PT_PORTAL_BLUE_GRAD_ENG_1.JPG width=142 height=16></td>
<td class=searchBar width=90%>
<font class=searchBarSize> </font></td>
</tr>
<tr>
<td valign=top>
<img src=Included_Files/PT_PORTAL_SHADOW_GRAD_ENG_1.gif width=142 height=5></td>
<td valign=bottom>
<table width=100% border=0 cellspacing=0 cellpadding=0 height=20>
<tr>
<td width=3% valign=bottom class=buttonBar nowrap=true>
<img src=Included_Files/PT_PORTAL_BLUE_CORNER_ENG_1.gif width=24 height=14></td>
<td width=20% class=buttonBar nowrap=true><nobr>
<a href=Home.Asp target=main class=headerLink>
<span onMouseOver="this.style.textDecoration='underline'" onMouseOut="this.style.textDecoration='none'">
<img src=Included_Files/PIA_HOME_ENG_1.gif ALT='Go To Home Page' border=0 align=absmiddle>
Home</span></a></nobr></td>
<td width=20% class=buttonBar nowrap=true><nobr>
<% If Session("SHOW_AUDITING_MENU") Then Response.Write "<a href=SelectDB.Asp target=main class=headerLink>" %>
<span class=headerLink
<% If Session("SHOW_AUDITING_MENU") Then Response.Write "onMouseOver=this.style.textDecoration='underline'" %>
onMouseOut="this.style.textDecoration='none'">
<img src=Included_Files/PT_PORTAL_IC_LOGOUT_ENG_1.gif ALT='Switch Database' border=0 align=absmiddle>
Database</span>
<% If Session("SHOW_AUDITING_MENU") Then Response.Write "</a>" %>
<span class=headerLink> (<%
DBNAME = Session("DB")
DBNAME = Replace(DBNAME,"Provider=SQLOLEDB.1;Persist Security Info=False;User ID=MyUserID;Password=MyPassword;Initial Catalog=","")
DBNAME = Left(DBNAME, 6)
Response.Write DBNAME%>)
</span>
</nobr></td>
<td width=10% class=buttonBar nowrap=true> </td>
<td width=10% class=buttonBar nowrap=true> </td>
<td width=10% class=buttonBar nowrap=true> </td>
<td width=10% class=buttonBar nowrap=true> </td>
<td width=20% class=buttonBar nowrap=true><nobr>
<a href=http://MyCompanynet/ target=_top class=headerLink>
<span onMouseOver="this.style.textDecoration='underline'" onMouseOut="this.style.textDecoration='none'">
<img src=Included_Files/PT_PORTAL_IC_LOGOUT_ENG_1.gif ALT='Go To MyCompanynet' border=0 align=absmiddle>
Logout</span></a>
<span class=headerLink> (<%=Replace(Trim(UCASE(Request.ServerVariables("AUTH_USER"))),Session("Domain"),"")%>)</span>
</nobr></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

Links suddenly stop reacting after migrating MyFaces 1.2 to 2.1

I recently switched my Eclipse Indigo project from JSF 1.2 to JSF 2.1 (using MyFaces). Using Tomcat 7.
Strange thing happens: I set up a project, and it works fine for some short
time, and then suddenly (maybe after I do "clean") stops working in a sense that
clicking a command link does not produce any action, backing bean's method is not
called, just nothing happens. I have tried to do project "clean" and Eclipse
restart, and even system restart but it did not help. Only thing that helped is
that I created a brand new workspace, and new project - but same thing happened:
this too worked only for short time and suddenly stoped working in the same way
- command links are just not reacting to clicks, and there is no way I can debug Java
code to at least localize the problem.
What could be the reason for such a strange behaviour?
Thanks in advance.
Update: this is the JavaScript error reported:
myfaces is not defined
onclick()onclick (line 2)
event = click clientX=840, clientY=252
return myfaces.oam.submitForm("j_id_6", "j_id_6:LOGIN");
function onclick(event) {
return myfaces.oam.submitForm("j_id_6", "j_id_6:LOGIN");
}
Here is the original XHTML file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:t="http://myfaces.apache.org/tomahawk">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Login</title>
</h:head>
<body style="background-color:#3d3d3d;" text="#000000" link="#cc0000" alink="#666666" vlink="#cc0000" onload="document.forms[0].USERNAME.focus();">
<f:view>
<h:form target="_top">
<table border="0" align="center" width="810" style="border: 2px black solid; background-image:url(images/header.jpg); margin:auto;" cellspacing="0" cellpadding="0">
<tr>
</tr>
</table>
<table align="center" width="810" style="border: 2px black solid; background-color:#ffffff;" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" height="10" colspan="3" align="center" valign="middle">
</td>
</tr>
<tr>
<td colspan="3">
<table width="778" align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="778"><h1>Login</h1>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td height="20"><font class="text">User Name: </font></td>
<td height="20"><font class="text"><t:inputText forceId="true" id="USERNAME" maxlength="50" value="#{LoginBean.username}" size="26" /></font></td>
</tr>
<tr>
<td height="20"><font class="text">Password: </font></td>
<td height="20"><font class="text"><h:inputSecret maxlength="30" value="#{LoginBean.password}" size="26" /></font></td>
</tr>
<tr>
<td height="20" colspan="2" align="right"><h:commandLink id="LOGIN" action="#{LoginBean.doLogin}"><h:graphicImage style="border: none" value="images/login.png" /></h:commandLink></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</h:form>
</f:view>
</body>
</html>
Here is the generated HTML:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Login</title></head>
<body style="background-color:#3d3d3d;" text="#000000" link="#cc0000" alink="#666666" vlink="#cc0000" onload="document.forms[0].USERNAME.focus();"><form id="j_id2030916047_790d5181" name="j_id2030916047_790d5181" method="post" action="/EWC/login.faces" enctype="application/x-www-form-urlencoded" target="_top">
<table border="0" align="center" width="810" style="border: 2px black solid; background-image:url(images/header.jpg); margin:auto;" cellspacing="0" cellpadding="0">
<tr>
</tr>
</table>
<table align="center" width="810" style="border: 2px black solid; background-color:#ffffff;" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" height="10" colspan="3" align="center" valign="middle">
</td>
</tr>
<tr>
<td colspan="3">
<table width="778" align="center" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="778"><h1>Login</h1>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td height="20"><font class="text">User Name: </font></td>
<td height="20"><font class="text"><input id="USERNAME" name="USERNAME" type="text" value="" maxlength="50" size="26" /></font></td>
</tr>
<tr>
<td height="20"><font class="text">Password: </font></td>
<td height="20"><font class="text"><input type="password" name="j_id2030916047_790d5181:j_id2030916047_790d51ba" maxlength="30" size="26" /></font></td>
</tr>
<tr>
<td height="20" colspan="2" align="right"><script type="text/javascript" src="/EWC/javax.faces.resource/oamSubmit.js.faces?ln=org.apache.myfaces"></script><img src="images/login.png" style="border: none" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table><input type="hidden" name="j_id2030916047_790d5181_SUBMIT" value="1" /><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="5s3ZqoVcUIwarcQb6pVzFIPhMJIzbVHnjMrXdtgA1Nten7grU/y0hMGbHtFvIExuKQOwB3IGzcSDeuPfijYMcnK23q/2N1mduMdr6RskySGELSaI2w93nL9b8NE=" /></form>
</body>
</html>
<context-param>
<param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
<param-value>true</param-value>
</context-param>
add it in ur Web.xml
everything will start.

Resources