VBA .innertext using getelements*, cannot locate areas in html code - excel

I am trying to create a macro to get the innertext from an internal webpage. I am not sure on how to properly locate the where the text is and would appreciate some direction and possibly some explanation on the approach.
I have tried numerous variations of using the getelementsby/tagname/classname to no avail. im not sure i understand the logic behind locating the areas after using the inspection function.
Var = ie.document.getelementClassName("sections").getElementsByTagName("table").Item(0).innerText
'also tried
Var = ie.document.getelementClassName("sections").getElementsByTagName("table").Item(1).getElementsByTagName("tr").Item(2).getElementsByTagName("td").Item(0).innerText
Var = ie.document.getelementTagName("section").getElementsByTagName("table").Item(1).getElementsByTagName("tr").Item(2).getElementsByTagName("td").Item(0).innerText
ActiveCell.Offset(0, 1).Value = Var
<html class=" js flexbox canvas canvastext webgl no-touch geolocation postmessage websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface no-generatedcontent video audio localstorage sessionstorage webworkers no-applicationcache svg inlinesvg smil svgclippaths" lang="" style=""><!--<![endif]--><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>NTC Tracking</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="stylesheet" href="/Content/bootstrap.min.css">
<!-- <link rel="stylesheet" href="~/Content/bootstrap-theme.min.css">-->
<!--For Plugins external css-->
<link rel="stylesheet" href="/Content/plugins.css">
<!--Theme custom css -->
<link rel="stylesheet" href="/Content/style.css">
<!--Theme Responsive css-->
<link rel="stylesheet" href="/Content/responsive.css">
<script src="/Scripts/vendor/modernizr-2.8.3-respond-1.4.2.min.js"></script>
</head>
<body data-spy="scroll" data-target="#main-navbar">
<!--[if lt IE 8]>
<p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please upgrade your browser to improve your experience.</p>
<![endif]-->
<div class="preloader" style="display: none;"><div class="loaded" style="display: none;"> </div></div>
<div id="menubar" class="main-menu">
<nav class="navbar-default navbar-fixed-top" style="background-color:#ffc038; padding:20px;">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="" href="http://10.102.18.162/"><img src="/images/msjlogo.png" style="max-width:50%; margin-top:-20px;"></a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li><span style="font-weight:100; font-size:10px;">Proxy Plus(5/22/2019 8:20:00 AM) | IQ(5/22/2019 8:31:00 AM) | Vendors(5/21/2019 2:24:00 PM) | USPS(5/22/2019 8:43:00 AM) | International(5/21/2019 2:24:00 PM)</span></li>
</ul>
</div><!-- /.navbar-collapse -->
<div>
<a class="navbar-brand" href="/"><h3>NTC Tracking</h3></a>
</div>
<div style="clear:both; margin-bottom:20px;"></div>
<div>
</div>
</div><!-- /.container-fluid -->
</nav>
</div>
<!--Home page style-->
<header id="home" class="sections">
</header>
<!-- Sections -->
<header id="home">
<div class="container">
<h2 align="center">Search Job</h2>
<div class="col-md-6 col-md-offset-3 col-sm-6 col-xs-12">
<p align="center">Description of this view, testing space and top bar at the same time</p>
<p align="center">There are some hiding fields due to the web space, if you want to see them click on export</p>
<p align="center">Description of this view, testing space and top bar at the same time</p>
<p align="center">Description of this view, testing space and top bar at the same time</p>
</div>
</div>
<br>
</header>
<section class="sections">
<div class="portfolio">
<div align="center" class="portfolio-item">
<h5 align="center">Job Number </h5><input id="PPNumber" name="PPNumber" type="text" value="P23315"><br>
<a onclick="submitdata();" href="#" class="btn btn-primary">Search </a>
<br><br>
<div>
<p></p>
</div>
<div style="float:left"><h3 align="left">JOB</h3></div>
<table class="table" style="font-size:11px;">
<tbody><tr>
<th>
Job #
</th>
<th width="20%">
Job Name
</th>
<th>
MeetingDate
</th>
<th>
DropDate
</th>
<th>
NTCMailDate
</th>
<th>
LI#
</th>
<th>
Total Pieces
</th>
<th width="5%">
Day 40 On
</th>
<th width="5%">
Logistics Processed
</th>
<th width="5%">
IQ Status
</th>
<th>
MustMail Comments
</th>
<th>
Total Batch Completed
</th>
<th>
Actual Status
</th>
<th>
Options
</th>
</tr>
<tr>
<td>
P23315-010 </td>
<td width="20%">
ATLANTICA YIELD PLC <----****I NEED THIS****
</td>
<td>
6/20/2019
</td>
<td>
5/13/2019
</td>
<td>
5/13/2019
</td>
<td>
LI-8154090
</td>
<td>
2200
</td>
<td width="5%">
5/11/2019
</td>
<td width="5%">
4386
</td>
<td width="5%">
Mailed
</td>
<td>
MUST MAIL 5/14
</td>
<td>
11 out of 11
</td>
<td>
Foreign Client
</td>
<td>
<a class="btn btn-default" href="/Report/Reopenjob?jobnumber=P23315&jobref=P23315-010">Reopen Job</a>
</td>
</tr>
</tbody></table>
<br>
<br>
</div>
</div>
</section>
<script>
function submitdata(){
var valtext = $("#PPNumber").val();//you can do also by getelementbyid
window.location.href = '/Report/Search/' + valtext;
}
function ShowMessage() {
var result = prompt("Please insert a comment if required.", "");
if (result == null) {
return false; //break out of the function early
}
document.getElementById('comments').value = result;
return true;
}
</script>
<div class="scroll-top">
<div class="scrollup">
<i class="fa fa-angle-double-up"></i>
</div>
</div>
<!--Footer-->
<footer id="footer" class="footer">
<div class="container">
<div class="row">
<div class="socio-copyright">
<div class="social">
</div>
<p>Made by Broadridge 2017. All rights reserved.</p>
</div>
</div>
</div>
</footer>
<script src="/Scripts/vendor/bootstrap.min.js"></script>
<script src="/Scripts/vendor/jquery-1.11.2.min.js"></script>
<script src="/Scripts/plugins.js"></script>
<script src="/Scripts/main.js"></script>
</body></html>
error 438

Here's the general logic of how to access the cells of an HTML table:
Sub test()
Dim sht As Worksheet
Dim doc As New HTMLDocument
Dim targetTable As HTMLTable
Set sht = ThisWorkbook.Worksheets("Sheet1")
doc.body.innerHTML = sht.Range("M1") 'I just stored the html code in cell M1 as a string for the sake of demonstration
Set targetTable = doc.getElementsByClassName("table")(0) 'Get the first element from a collection of elements whose class name is "table"
Debug.Print targetTable.Rows(0).Cells(0).innerText 'Get the first row from the collection of rows that belong to the table and the first cell from the collection of cells that belong to this row.
End Sub
The code above will print Job # in the immediate window. This is the inner text of the first cell of the first row (which is the header of the first column). You can get the rest of the values accordingly.
Things to remember:
doc.getElementsByClassName("table") is a collection of elements whose class name is "table"
Same applies to .getElementsByTagName etc.
The first item in the collection has an index of 0
You can loop through all the elements in a collection using a For-Each
This .getelementClassName is wrong
This doc.getElementsByClassName("table")(0).getElementsByTagName("td")(0).innerText is correct
You can access an item in the collection either like that doc.getElementsByClassName("Something").Item(0) or like that doc.getElementsByClassName("Something")(0)

The error:
The method is
getElementsByClassName
or
getElementsByTagName
These return collections which you then index into e.g.
ie.document.getElementsByClassName("className")(0) 'first element
Making those changes should handle your initial error.
Targeting specific row and column:
You can use nth-of-type if automating with IE i.e. tr:nth-of-type(rowNumberHere) , td:nth-of-type(columnNumberHere).
I think you are after the second row first column so I would use css selectors
ie.document.querySelector(".table tr:nth-of-type(2) td:nth-of-type(1)").innerText
Modern browsers are optimized for css selectors so this should be an efficient method.
Entire table:
An easy way to copy an entire table is to use the clipboard
Option Explicit
Public Sub GetInfo()
Dim ie As New InternetExplorer, url As String, ws As Worksheet
Dim t As Date, clipboard As Object, hTable As Object
url = "url"
Const MAX_WAIT_SEC As Long = 10
Set ws = ThisWorkbook.Worksheets("Sheet1")
Set clipboard = GetObject("New:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
With ie
.Visible = True
.Navigate2 url
While .Busy Or .readyState < 4: DoEvents: Wend
With .document
t = Timer
Do
On Error Resume Next
Set hTable = .querySelector(".table")
On Error GoTo 0
If Timer - t > MAX_WAIT_SEC Then Exit Do
Loop While hTable Is Nothing
End With
If hTable Is Nothing Then Exit Sub
clipboard.SetText hTable.outerHTML
clipboard.PutInClipboard
ws.Range("A1").PasteSpecial
.Quit
End With
End Sub
Looping rows and columns of a table:
If you want to loop rows and columns of a table and write out, see here.

Related

Online result search aplication first html page should render the form and second page will show the data. Help Appricated?

Django, I have two HTML pages first is index.html which shows the home page along with the search field and the second HTML form is the result which shows the desired result which is search by the user. I have already written code that is working fine on only one page but I want to redirect the home page once the user fillup the details it should go to the next page called result.html.
modles.py
from django.db import models
from django.utils.encoding import smart_text
from multiselectfield import MultiSelectField
# Create your models here.
class ResultQuery(models.Model):
os_choice = (
('Windows 10', 'Windows 10'),
('Windows 8', 'Windows 8'),
('Linux', 'Linux'),
)
operating_system = models.CharField(max_length=30, blank=True, null=True, choices=os_choice)
level = models.CharField(max_length=30)
program = models.CharField(max_length=30)
semester = models.CharField(max_length=20)
exam_year = models.IntegerField()
institute = models.CharField(max_length=4)
reg_no = models.CharField(max_length=50)
symbol_num = models.IntegerField()
student_name = models.CharField(max_length=50)
dob = models.DateField()
sgpa = models.TextField()
result = models.CharField(max_length=40)
name = models.CharField(max_length=30)
subject1_code=models.CharField(max_length=40)
subject1_title=models.CharField(max_length=40)
subject1_credit_hour=models.TextField()
subject1_grade_point=models.TextField()
subject1_grade=models.TextField()
subject1_remarks=models.CharField(max_length=20, null=True, blank=True)
subject2_code = models.CharField(max_length=40)
subject2_title = models.CharField(max_length=40)
subject2_credit_hour = models.TextField()
subject2_grade_point = models.TextField()
subject2_grade = models.TextField()
subject2_remarks = models.CharField(max_length=20, null=True, blank=True)
subject3_code = models.CharField(max_length=40)
subject3_title = models.CharField(max_length=40)
subject3_credit_hour = models.TextField()
subject3_grade_point = models.TextField()
subject3_grade = models.TextField()
subject3_remarks = models.CharField(max_length=20, null=True, blank=True)
subject4_code = models.CharField(max_length=40)
subject4_title = models.CharField(max_length=40)
subject4_credit_hour = models.TextField()
subject4_grade_point = models.TextField()
subject4_grade = models.TextField()
subject4_remarks = models.CharField(max_length=20, null=True, blank=True)
subject5_code = models.CharField(max_length=40)
subject5_title = models.CharField(max_length=40)
subject5_credit_hour = models.TextField()
subject5_grade_point = models.TextField()
subject5_grade = models.TextField()
subject5_remarks = models.CharField(max_length=20, null=True, blank=True)
subject6_code = models.CharField(max_length=40)
subject6_title = models.CharField(max_length=40)
subject6_credit_hour = models.TextField()
subject6_grade_point = models.TextField()
subject6_grade = models.TextField()
subject6_remarks = models.CharField(max_length=20, null=True, blank=True)
def __str__(self):
return smart_text(self.name)
forms.py
from django import forms
from search.models import ResultQuery
from django.forms import MultipleChoiceField, ChoiceField, Form
class ResultForm(forms.Form):
Reg_No = forms.CharField(label="Registration Number")
Name = forms.CharField(label="Your Name")
OS = forms.ChoiceField(choices=ResultQuery.os_choice)
views.py
from django.shortcuts import render
# Create your views here.
from django.shortcuts import render
from .forms import ResultForm
from .models import ResultQuery
def home(request):
form=ResultForm(request.POST or None)
template_name = "index.html"
context = {"form": form}
if form.is_valid():
objects = ResultQuery.objects.filter(reg_no=form.cleaned_data['Reg_No'], name=form.cleaned_data['Name'], operating_system=form.cleaned_data['OS'])
context['objects'] = objects
return render(request, template_name, context)
index.html
{% load static %}
{% load crispy_forms_tags %}
{% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>online</title>
<meta name="description" content="Source code generated using layoutit.com">
<meta name="author" content="LayoutIt!">
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'css/style.css' %}" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>
<body>
<div class="container-fluid">
<div class="row" id="top">
<div class="col-md-12">
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-4" id="h4">
</div>
<div class="col-md-4" id="logo">
<img src="img/logo.png" alt="" srcset="">
<br>
<h1 class="a">Saj University School of Management</h1>
</div>
<div class="col-md-4" id="h4">
<h4>Online Result Form</h4>
</div>
</div>
<div class="row" id="top">
<div class="col-md-12">
</div>
</div>
<br>
<div class="row">
<div class="col-md-4">
<form action="" method="POST">
{% csrf_token %}
{{form|crispy}}
<select class="amrit" name="cars" id="cars">
<optgroup>
<option value="none" selected disabled hidden>Select an Institution</option>
<option value="management">School of Management</option>
<option value="engineering">Faculty of Engineering</option>
<option value="science">Faculty of Science and Technology</option>
</optgroup>
</select>
<br>
<select class="amrit" name="cars" id="cars">
<optgroup>
<option value="none" selected disabled hidden>Select a level</option>
<option value="management">Bachelor</option>
<option value="engineering">Master</option>
</optgroup>
</select>
<br>
<select class="amrit" name="cars" id="cars">
<optgroup>
<option value="none" selected disabled hidden>Select a Program</option>
<option value="management">BBA</option>
<option value="engineering">MBA</option>
<option value="engineering">BHM</option>
</optgroup>
</select>
<br>
<select class="amrit" name="cars" id="cars">
<optgroup>
<option value="none" selected disabled hidden>Select a Semester</option>
<option value="management">1st</option>
<option value="engineering">2nd</option>
<option value="engineering">3rd</option>
<option value="third">4th</option>
<option value="firth">5th</option>
<option value="sixth">6th</option>
<option value="seventh">7th</option>
<option value="eight">8th</option>
</optgroup>
</select>
<br>
<input type="search" placeholder="Exam Year" name="year" id="year">
<br>
<input type="search" placeholder="Symbol Number" name="year" id="year">
<br>
<input type="search" placeholder="DOB(YYYY-MM-DD)" name="dob" id="year">
<br>
<button type="submit" id="year" name="search">Search</button>
</form>
</div>
<div class="col-md-4" id="sliderbor"> <!--slider start-->
<div class="hero">
<div class="w3-content w3-display-container">
<img class="mySlides" src="{% static 'img/inaki-del-olmo-NIJuEQw0RKg-unsplash.jpg' %}" style="width:100%">
<img class="mySlides" src="{% static 'img/inaki-del-olmo-NIJuEQw0RKg-unsplash.jpg' %}" style="width:100%">
<img class="mySlides" src="{% static 'img/inaki-del-olmo-NIJuEQw0RKg-unsplash.jpg' %}" style="width:100%">
<img class="mySlides" src="{% static 'img/inaki-del-olmo-NIJuEQw0RKg-unsplash.jpg' %}" style="width:100%">
<button class="w3-button w3-black w3-display-left" onclick="plusDivs(-1)">❮</button>
<button class="w3-button w3-black w3-display-right" onclick="plusDivs(1)">❯</button>
</div>
<script>
var slideIndex = 1;
showDivs(slideIndex);
function plusDivs(n) {
showDivs(slideIndex += n);
}
function showDivs(n) {
var i;
var x = document.getElementsByClassName("mySlides");
if (n > x.length) {slideIndex = 1}
if (n < 1) {slideIndex = x.length}
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
x[slideIndex-1].style.display = "block";
}
</script>
<!--slider end-->
</div>
</div>
</div>
<div class="col-md-12" id="h6">
<h3><b>Announcement</b></h3>
<marquee behavior="scroll" direction="left" id="mymarquee" scrollamount="10">
<h4>Brothers and Sisters, the time has come for each and every one of you to decide whether you are going to be the problem or whether you are going to be the solution! (That's right!)
You must choose Brothers, you must choose!It takes five seconds, five seconds of decision, five seconds to realize your purpose here on the planet!
It takes five seconds to realize that it's time to move, it's time to get down with it! Brother</h4>
</marquee>
<input type="button" value="⏸" onClick="document.getElementById('mymarquee').stop();">
<input type="button" value="▶️" onClick="document.getElementById('mymarquee').start();">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-4" id="h4">
</div>
</div>
<div class="row" id="top1">
<div class="col-md-12">
</div>
</div>
<div class="row">
<div class="col-md-12" id="footer">
<p>© 2021 Sajtheme, Nepal | All Rights Reserved.</p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="row">
<div class="col-md-4" id="h4">
</div>
</div>
<div class="row" id="top13">
<div class="col-md-12">
</div>
</div>
</div>
<script src="{% static 'js/jquery.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/scripts.js' %}"></script>
</body>
</html>
{% endblock content %}
result.html
{% load static %}
{% load crispy_forms_tags %}
{% block content %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Result</title>
<meta name="description" content="Source code generated using layoutit.com">
<meta name="author" content="LayoutIt!">
<link href="{% static 'css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'css/style.css' %}" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
</div>
<div class="col-md-4" id="logo">
<img src="{% static 'img/logo.png' %}" alt="" srcset="">
<h4>Saj University School of Management</h4>
<h5>(An Autonomous Institution)</h5>
<h6>Surkhet, Nepal</h6>
<br>
<h6 style="text-decoration: underline;">Grade Sheet</h6>
</div>
<div class="col-md-4">
</div>
</div>
<div class="row">
<div style="clear:both;" class="col-md-4" id="p1">
<p>Name: Amrit Shahi</p>
<p>DOB: 1994-10-22</p>
<p>Level: Master</p>
<p>Semester: First</p>
</div>
<div class="col-md-4">
</div>
<div style="clear:both;" class="col-md-4" id="p2">
<p>Regd. No: xxx-xx-xx-xxxx</p>
<p>Exam Roll No: 256225</p>
<p>Programme: MBA</p>
<p>Exam Year: 2020</p>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table" id="bro">
<thead>
<tr>
<th>
S.N
</th>
<th>
Course Code No.
</th>
<th>
Course Title
</th>
<th>
Cr. Hr.
</th>
<th>
Grade Point
</th>
<th>
Grade
</th>
<th>
Remarks
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
MGT 511
</td>
<td>
Foundation of Managmeent
</td>
<td>
3
</td>
<td>3.67</td>
<td>A-</td>
<td></td>
</tr>
<tr class="table-active">
<td>
2
</td>
<td>
MGT 512
</td>
<td>
Critical Thinking
</td>
<td>
3
</td>
<td>3</td>
<td>B-</td>
<td></td>
</tr>
<tr class="table-success">
<td>
3
</td>
<td>
MGT 513
</td>
<td>
Communication for Managers
</td>
<td>
3
</td>
<td>3</td>
<td>B-</td>
<td></td>
</tr>
<tr class="table-warning">
<td>
4
</td>
<td>
MGT 514
</td>
<td>
Financial Accounting
</td>
<td>
3
</td>
<td>3.33</td>
<td>B</td>
<td></td>
</tr>
<tr class="table-danger">
<td>
5
</td>
<td>
MGT 515
</td>
<td>
Research Methodology
</td>
<td>
3
</td>
<td>2.5</td>
<td>C</td>
<td></td>
</tr>
<tr class="table-active">
<td colspan="3">Total Credit Hour and Semester Wise Grade Point Average </td>
<td>18</td>
<td>3.2</td>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="8" class="par"><center>Result: Passed</center></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="row">
<div class="col-md-12">
</div>
</div>
</div>
<script src="{% static 'js/jquery.min.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/scripts.js' %}"></script>
</body>
</html>
{% endblock content %}

How to update jBoxes?

I have a form that uses jBox to provide additional info for some fields in tooltips. The text that is displayed depends on the value of the closest select-tag. jBox is executed on PageLoad (I create a single jBox which uses data-attributes to get title and content) and I then update the data-attributes in response to the change-event on the select-control.
Unfortunately that does not work, the tooltip stays with the initial value.
I have a cut-down repro with tooltip that illustrates the behaviour of not being updated (alertis used to show actual values of data-attributes after a change-event)
$(function() {
$("[data-jbox-content]").jBox("Tooltip", {
theme: "TooltipDark",
id: "jBoxTooltip",
getTitle: "data-jbox-title",
getContent: "data-jbox-content"
});
});
<link href="https://cdn.jsdelivr.net/gh/StephanWagner/jBox#v1.0.5/dist/jBox.all.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/StephanWagner/jBox#v1.0.5/dist/jBox.all.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" rel="stylesheet"/>
<body>
<table>
<tbody>
<tr>
<th>Variable</th>
<th colspan="2">Type</th>
<th>Description</th>
</tr>
<tr>
<td><label for="dt1">Car</label></td>
<td><select id="dtCar" class="form-control select2 font-fas" name="dtCar" onchange="$('#infoCar').data('jbox-title','blabla');$('#infoCar').data('jbox-content','dummy');alert($('#infoCar').data('jbox-title')+' / ' + $('#infoCar').data('jbox-content'))">
<option>Key</option>
<option selected="selected">Boolean</option>
<option>Ordinal</option>
<option>Nominal</option>
<option>Interval</option>
<option>Ratio</option>
</select>
</td>
<td><span id="infoCar" data-jbox-content="This field can have one of two values: On or Off, Yes or No, 1 or 0." data-jbox-title="Description of the Boolean Scale">
<i class="fas fa-info-circle"></i></span></td>
<td><input id="inCar" class="form-control" name="inCar" type="text" value="Do you own a car?"></td>
</tr>
<tr>
<td><label for="dt2">Age</label></td>
<td><select id="dtHouse" class="form-control select2 font-fas" name="dtAge" onchange="$('#infoAge').data('jbox-title','blabla');$('#infoAge').data('jbox-content','dummy');alert($('#infoAge').data('jbox-title')+' / ' + $('#infoAge').data('jbox-content'))">
<option>Key</option>
<option>Boolean</option>
<option>Ordinal</option>
<option>Nominal</option>
<option selected="selected">Interval</option>
<option>Ratio</option>
</select>
</td>
<td><span id="infoAge" data-jbox-content="This field can values from a defined interval, i.e. 0..200" data-jbox-title="Description of the Interval Scale">
<i class="fas fa-info-circle"></i></span></td>
<td><input id="inHouse" class="form-control" name="inAge" type="text" value="How old are you?"></td>
</tr>
</tbody>
</table>
</body>
There is a common misunderstanding of how jQuery uses .data() and .attr() methods.
.data() adds some internal data to the element itself and will not set an attribute.
To set a data-xxx attribute you need to use .attr(). See more here: https://api.jquery.com/attr/
Also, check out updated snippet:
$(function() {
$("[data-jbox-content]").jBox("Tooltip", {
theme: "TooltipDark",
id: "jBoxTooltip",
getTitle: "data-jbox-title",
getContent: "data-jbox-content"
});
});
<link href="https://cdn.jsdelivr.net/gh/StephanWagner/jBox#v1.0.5/dist/jBox.all.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/StephanWagner/jBox#v1.0.5/dist/jBox.all.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.9.0/css/all.min.css" rel="stylesheet"/>
<body>
<table>
<tbody>
<tr>
<th>Variable</th>
<th colspan="2">Type</th>
<th>Description</th>
</tr>
<tr>
<td><label for="dt1">Car</label></td>
<td><select id="dtCar" class="form-control select2 font-fas" name="dtCar" onchange="$('#infoCar').attr('data-jbox-title','blabla');$('#infoCar').attr('data-jbox-content','dummy');">
<option>Key</option>
<option selected="selected">Boolean</option>
<option>Ordinal</option>
<option>Nominal</option>
<option>Interval</option>
<option>Ratio</option>
</select>
</td>
<td><span id="infoCar" data-jbox-content="This field can have one of two values: On or Off, Yes or No, 1 or 0." data-jbox-title="Description of the Boolean Scale">
<i class="fas fa-info-circle"></i></span></td>
<td><input id="inCar" class="form-control" name="inCar" type="text" value="Do you own a car?"></td>
</tr>
<tr>
<td><label for="dt2">Age</label></td>
<td><select id="dtHouse" class="form-control select2 font-fas" name="dtAge" onchange="$('#infoAge').attr('data-jbox-title','blabla');$('#infoAge').attr('data-jbox-content','dummy');">
<option>Key</option>
<option>Boolean</option>
<option>Ordinal</option>
<option>Nominal</option>
<option selected="selected">Interval</option>
<option>Ratio</option>
</select>
</td>
<td><span id="infoAge" data-jbox-content="This field can values from a defined interval, i.e. 0..200" data-jbox-title="Description of the Interval Scale">
<i class="fas fa-info-circle"></i></span></td>
<td><input id="inHouse" class="form-control" name="inAge" type="text" value="How old are you?"></td>
</tr>
</tbody>
</table>
</body>

XPATH Syntax - Katalon Studio

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']

VBA Excel - Filling in webforms unable to click submit button

I am fairly new to coding and took on this project to create 1000 new accounts in an internal program we have at my work. I was able to get the macro to fill in the webform and proceed through 2 pages however at the third page I was unable to get it to click the submit button.
Code:
Sub Automate1()
Dim IE As Object
Dim doc As HTMLDocument
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "https://associate.heritagerep.com/signup/signup.asp?
SectionID=10&t=10030&guid=CB57C450-F8D2-4644-98CB-99C37DA43668"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Set doc = IE.document
'First Screen'
doc.getElementsByName("sponsor")(0).Value = "kffrep"
doc.getElementById("Username").Value = "75871"
doc.getElementById("email").Value = "75871#kff.com"
doc.getElementById("zip").Value = "111111"
doc.getElementsByName("Submit")(0).Click
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
'Second Screen'
doc.getElementById("companyName").Value = "kff1"
doc.getElementById("OccupationTy_Select").Value = 34
doc.getElementById("fname").Value = "75871"
doc.getElementById("lname").Value = "kff1"
doc.getElementById("mstreet1").Value = "1 kff st"
doc.getElementById("mcity").Value = "Mississauga"
doc.getElementById("mstate").Value = "ON"
doc.getElementById("hphone").Value = "1111111"
doc.getElementById("emailConfirm").Value = "75871#kff.com"
doc.getElementsByName("SSN")(0).Value = "000000000"
doc.getElementById("password").Value = "password1"
doc.getElementById("passwordconfirm").Value = "password1"
doc.getElementsByName("securityanswer")(0).Value = "pizza"
doc.getElementsByClassName("btn btn-primary")(0).Click
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
'Third Screen'
Set tags = doc.getElementsByClassName("btn btn-success")
For Each tagx In tags
If tagx.Name = "submitfinish" Then
tagx.Click
End If
Next
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
'Fourth Screen'
doc.getElementsByName("Submit3")(0).Click
'Fifth Screen'
doc.getElementsByName("CheckOrderPaid")(0).Click
doc.getElementsByName("Shipped")(0).Click'
doc.getElementsByName("subAdminOpt")(0).Click
Flag
End Sub
Below is the HTML code for the troublesome button:
<input name="submitfinish" class="btn btn-success" type="submit" value="Finish Order">
I am not sure why the actions I used in the first 2 pages to click the submit button are suddenly not working on the third page. I have tried may different iterations trying to work around the problem but have yet to find one that is successful.
Appreciate any feedback.
Additional DOM Details:
<div class="text-right">
<a class="btn btn-default" href="/default.asp?guid=651F5B01-725B-4CCD-B12E-17CD5D59C472">Continue Shopping<!--Continue Shopping--></a>
<input name="submitcalc" class="btn btn-default" type="submit" value="Re-Calculate">
<input name="submitfinish" class="btn btn-success" type="submit" value="Finish Order"><!--Finish Order -->
</div>
Entire webpage HTML:
<!DOCTYPE html>
<html lang="en" class="non-mobile">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<meta content='width=device-width, initial-scale=1.0, maximum-
scale=1.0, user-scalable=0' name='viewport' />
<!-- Scripts -->
<script type="text/javascript" src="//code.jquery.com/jquery-
1.11.0.min.js"></script>
<script type="text/javascript" src="/common/script.js"></script>
<script type="text/javascript" src="/common/function/script_source.js"></script>
<script type="text/javascript" src="/common/jquery/jquery.validate.min.js"></script>
<script type="text/javascript" src="/common/function/functions.js"></script>
<!-- bootstrap -->
<script type="text/javascript" src="/responsive/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/responsive/js/common.js"></script>
<script type="text/javascript" src="/common/shadowbox/shadowbox.js"></script>
<script type="text/javascript" src="/responsive/js/jquery.animate-colors-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.js"></script>
<script type="text/javascript" src="//unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<!-- CSS -->
<link href="/common/shadowbox/shadowbox.css" rel="stylesheet">
<link href="/responsive/css/bootstrap.css" rel="stylesheet">
<link href="/responsive/css/bootstrap-custom.css" rel="stylesheet">
<link href="/responsive/css/bootstrap-ms.css" rel="stylesheet">
<link href="//cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.css" rel="stylesheet">
<!-- Parent Site overrides -->
<link href="//associate.heritagerep.com/clientinc/resources/css/common.css" rel="stylesheet">
<style type="text/css">
#import url('//associate.heritagerep.com/common/templates/public/css/custom.css');
</style>
<script type="text/javascript">
$(function() {
app.init({ domain: 'associate.heritagerep.com'});
});
</script>
</head>
<body class="responsive">
<!-- This is a helper so javascript can see whether or not this is a mobile device -->
<div id="isMobile" class="visible-xs"></div>
<form method="post" name="currencyty">
<input type="hidden" name="CartId" value="439915">
<table class="table table-striped">
<thead>
<tr>
<th>ItemCode<!--ItemCode--></th>
<th>Description<!--Descr--></th>
<th>Qty<!--Qty--></th>
<th>Currency<!--Currency--></th>
<th>Price Each<!--Price Each--></th>
<th>
Volume
</th>
<th>Volume 2<!--Volume 2--></th>
<th>Price Total<!-- Total--></th>
<th>
Points Total
</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td> <!-- ITEM CODE -->
1004
</td>
<td><!-- Description -->
Initial Certification Fee
</td>
<td> <!-- QTY -->
<input name="Qty_609000021&609000020&0&-1&1004&N" type="text" value="1" size="2" onblur="WidthTest(this,1);" />
</td>
<td>CAD</td>
<td>
$25.00
</td>
<td>
0
</td>
<td>
0
</td>
<td>
$25.00
</td>
<td>
0
</td>
<td class="text-right">
Edit<!--Edit-->
</td>
</tr>
<tr>
<td colspan="100%">
<div class="pull-left">
Add Item<!--Add-->
</div>
<div class="pull-right">
<input name="adItemCode" type="text" value="Item Code" size="10" onclick="this.value = ''" onblur="WidthTest(this,1);AddTableRow('ProductItemCode')"><!--Item Code-->
Qty:<!--Qty:--> <input name="adNewQty" type="text" value="1" size="2" onblur="WidthTest(this,1);">
<span style="font-weight:bold;vertical-align: middle; float: right;">
<input type="submit" name="submitadd" value="Add Item" onclick="whichButton='add';"><!--Add Item-->
</span>
</div>
</td>
</tr>
</tbody>
</table>
<div class="pull-right">
<ul class="list-group">
<li class="list-group-item">
<strong>Volume:</strong>
0
</li>
<li class="list-group-item">
<strong>Totals<!--Totals :-->:</strong>
$25.00
</li>
</ul>
</div>
<div class="clearfix"></div>
<div class="text-right">
Continue Shopping<!--Continue Shopping-->
<input type="submit" name="submitcalc" value="Re-Calculate" class="btn btn-default">
<input type="submit" name="submitfinish" value="Finish Order" class="btn btn-success"><!--Finish Order -->
</div>
</form>
<script language="javascript">
$(function() {
$('.fancy').fancybox({
'width' : '75%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe',
'topRatio': '0.1',
'autoHeight': true
});
});
</script>
</body>
You could try and attribute = value selector to target element. Let us know if an error and if so check if there is a parent iframe/frame tag.
ie.document.querySelector("[value='Finish Order']").click
Or
ie.document.querySelector("[value='Finish Order']").FireEvent "onclick"

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?

Resources