Click on table of webpage with vbscript - vbscript

I would like to click on the first row of the table as given below. (Ex on '5101170017') with vbscript code. with which I am trying to scrape the webpage info. How can I do this. as this webpage is password protected I can not share the details.
<html>
<head>
<script src='../../accidentweb/interface/DwrUtilsDao.js'></script>
<script src='../../accidentweb/engine.js'></script>
<script src='../../accidentweb/util.js'></script>
<base href="http://114.255.167.200:8092/cidasEN/extend/">
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<LINK href="css/css.css" type=text/css rel=stylesheet>
<title>Functional Query results</title>
</head>
<body bottomMargin=0 leftMargin=0 topMargin=0 >
<TABLE border="1" bordercolorlight="#6D6D6D" cellspacing="1"
bordercolordark="#C0C0C0" width="120%"
cellpadding="0" bgcolor="#FFFFFF" class=font9 style="BORDER-bottom: #4D5E8C 1px solid" >
<tr bgcolor="#CCCCCC" >
<td class="title_1" width ='6%' align="center">department</td>
<td class="title_1" width ='6%' align="center">case number</td>
<td class="title_1" width ='10%' align="center">time of accident</td>
<td class="title_1" width ='20%' align="center">location of scene of accident</td>
<td class="title_1" width ='6%' align="center">operator</td>
</tr>
<tr bgcolor="#FFFFFF" style="cursor:hand"
onmouseover="onmouseoverTR(this)"
onmouseout="onmouseoutTR(this)"
onclick="clearwsInfo('2017070100002','2017070100002',this);"
ondblclick='doSelect("auditflowForm","2017070100002");'>
<TD align="center">
<script type="text/javascript" >
outprint('ChengDu Branch');
</script>
</TD>
<TD align="center">
<script type="text/javascript" >
outprint('5101170017');
</script>
</TD>
<TD align="center">
<script type="text/javascript" >
outprint('2017-06-02 17:50');
</script>
</TD>
<TD align="left">
<script type="text/javascript" >
outprint('成赤高速成自段自贡往成都方向48km');
</script>
</TD>
<TD align="left">
<script type="text/javascript" >
outprint('杨东升');
</script>
</TD>
</TR>
<script anguage="javascript" >
//clearwsInfo("2017070100002","2017070100002","");
</script>
</TABLE>
</body>
</html>
I've tried the following:
Set iframe = IE.Document.getelementbyID("listInfoFrame")
For Each ele In iframe.contentDocument.getElementsByTagName("td")
msgbox(ele.innertext)
If InStr(ele.innertext, "department") > 0 Then
Set Row = ele.ParentNode.NextSibling
Row.Click
Exit For
End If
Next
I am getting an error as Permission Denied 'iframe.contentDocument. Any one can help me please

Related

th:each datatable is not working in Bootstrap 4

I am using bootstrap4 DataTable.I am using spring boot. I have passed my data from my controller like bellow..
List<User> list = new ArrayList<>();
#GetMapping(value = "/staff-details")
public String staffDetails(Model model) {
model.addAttribute("staffList",list );
return "staff-details";
}
It is working fine when like bellow..that means there is no loop
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
<td>61</td>
<td>2011/04/25</td>
<td>$320,800</td>
</tr>
</tbody>
When I want to populate data dynamically from database, it is not working..I am using like bellow..
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.10.20/js/dataTables.bootstrap4.min.js"></script>
<script src=" https://cdn.datatables.net/fixedheader/3.1.6/js/dataTables.fixedHeader.min.js"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.20/css/dataTables.bootstrap4.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/fixedheader/3.1.6/css/fixedHeader.bootstrap4.min.css">
<script type="text/javascript">
$(document).ready(function () {
var table = $('#example').DataTable({
fixedHeader: true
});
});
</script>
</head>
<body>
<table id="example" class="table table-striped table-bordered" style="width:100%">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr th:each="user: ${staffList}">
<td th:text="${user.firstName +' '+ user.lastName}"></td>
<td th:text="${user.email}"></td>
<td th:text="${user.restaurantId}"></td>
<td th:text="${user.restaurantBranchId}"></td>
<td th:text="${user.userRole}"></td>
</tr>
</tbody>
</table>
</body>
Please help me why it is not working in loop..

How to Get Nokogiri to Show Node and not just HTML

Right now when I am parsing some html (front page of hacker news for example), it works fine. I can call class on something like doc = Nokogiri::HTML(open('news.ycombinator.com')) and I will get back Nokogiri::HTML::Document < Nokogiri::XML::Document
The issue is, in the terminal, I am seeing the HTML and not the actual Nokogiri Element. I want to see it because it shows me valuable info like the Nokogiri Elements Children, or an array of links or or or.
I get the HTML using the Watir Gem using the following method:
[1] pry(main)> browser = Watir::Browser.new(:firefox)
#<Watir::Browser:0x2c5654b29ef00c22 url="about:blank" title="">
[2] pry(main)> browser.goto('news.ycombinator.com')
"http://news.ycombinator.com"
[3] pry(main)> browser.html
Where browser.html is an instance variable (I think?) containing un-parsed HTML.
Here is what I get back right now if I call doc = Nokogiri::HTML.parse(browser.html)
And here is what I would like to get back:
Where am I going wrong?
adding raw code as requested:
Nokogiri::HTML::Document < Nokogiri::XML::Document
[31] pry(main)> doc = Nokogiri::HTML.parse(browser.html)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html op="news">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="referrer" content="origin">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="news.css?stXbi7LCyutClfTUMe1b">
<link rel="shortcut icon" href="favicon.ico">
<link rel="alternate" type="application/rss+xml" title="RSS" href="rss">
<title>Hacker News</title>
</head>
<body>
<center><table id="hnmain" width="85%" cellspacing="0" cellpadding="0" border="0" bgcolor="#f6f6ef">
<tbody>
<tr><td bgcolor="#ff6600"><table style="padding:2px" width="100%" cellspacing="0" cellpadding="0" border="0"><tbody><tr>
<td style="width:18px;padding-right:4px"><img src="y18.gif" style="border:1px white solid;" width="18" height="18"></td>
<td style="line-height:12pt; height:10px;"><span class="pagetop"><b class="hnname">Hacker News</b>
new | past | comments | ask | show | jobs | submit </span></td>
<td style="text-align:right;padding-right:4px;"><span class="pagetop">
login
</span></td>
</tr></tbody></table></td></tr>
<tr id="pagespace" title="" style="height:10px"></tr>
<tr><td>
<table class="itemlist" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr class="athing" id="19388248">
<td class="title" valign="top" align="right"><span class="rank">1.</span></td> <td class="votelinks" valign="top"><center><a id="up_19388248" href="vote?id=19388248&how=up&goto=news"><div class="votearrow" title="upvote"></div></a></center></td>
<td class="title">
Getting Too Absorbed in Your Side Projects<span class="sitebit comhead"> (<span class="sitestr">bennettnotes.com</span>)</span>
</td>
</tr>
<tr>
<td colspan="2"></td>
<td class="subtext">
<span class="score" id="score_19388248">42 points</span> by _davebennett <span class="age">1 hour ago</span> <span id="unv_19388248"></span> | hide | 27 comments </td>
</tr>
<tr class="spacer" style="height:5px"></tr>
<tr class="athing" id="19384878">
<td class="title" valign="top" align="right"><span class="rank">2.</span></td> <td class="votelinks" valign="top"><center><a id="up_19384878" href="vote?id=19384878&how=up&goto=news"><div class="votearrow" title="upvote"></div></a></center></td>
<td class="title">
Facebook’s Data Deals Are Under Criminal Investigation<span class="sitebit comhead"> (<span class="sitestr">nytimes.com</span>)</span>
</td>
</tr>
<tr>
<td colspan="2"></td>
<td class="subtext">
<span class="score" id="score_19384878">661 points</span> by tysone <span class="age">13 hours ago</span> <span id="unv_19384878"></span> | hide | 156 comments </td>
</tr>
<tr class="spacer" style="height:5px"></tr>
<tr class="athing" id="19388091">
<td class="title" valign="top" align="right"><span class="rank">3.</span></td> <td class="votelinks" valign="top"><center><a id="up_19388091" href="vote?id=19388091&how=up&goto=news"><div class="votearrow" title="upvote"></div></a></center></td>
<td class="title">
Krita 4.2.0: First painting application with HDR support on Windows<span class="sitebit comhead"> (<span class="sitestr">krita.org</span>)</span>
</td>
...
It sounds like you want:
doc = Nokogiri::HTML browser.html

Attribute th:each is not allowed here(Error in Thymeleaf template)

I have created the application that stores the Information about dogs in the database,while running the project the tables where created but dogs information were not updates.
There is an error in running this below html file
The following code is not working
<html lang="en">
<head>
<!-- META SECTION -->
<title>Dog Rescue</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- END META SECTION -->
<!-- BEGIN STYLE -->
<style>
table, th, td {
border: 1px solid black;
padding: 1px;
}
</style>
<!-- END STYLE -->
</head>
<body>
<h2>Current Dogs In Rescue</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Rescue Date</th>
<th>Vaccinated</th>
</tr>
</thead>
<tbody>
<tr th:each="dogs : ${dogs}">
<td th:text="${dogs.id}">Text ...</td>
<td th:text="${dogs.name}">Text ...</td>
<td th:text="${dogs.rescued}">Text ...</td>
<td th:text="${dogs.vaccinated}">Text...</td>
</tr>
</tbody>
</table>
</div>
<h2>Add A Dog</h2>
<form action="#" th:action="#{/}" method="post">
<label>Name<input type="text" name="name" id="name"></input></label>
<label>Vaccinated<input type="text" name="vaccinated" id="vaccinated"></input></label>
<label>Rescued<input type="text" name="rescued" id="rescued"></input></label>
<input type="submit" value="Submit"></input>
</form>
</body>
</html>
The html file is not fetching the information.
Kindly help me
Whole Project is available in
https://github.com/arulsuju/DogRescue.git
You are using the same variable name for iteration as the list variable (dogs)
, Consider using different name for iteration variable like (dog), so the code should be:
<tr th:each="dog : ${dogs}">
<td th:text="${dog.id}">Text ...</td>
<td th:text="${dog.name}">Text ...</td>
<td th:text="${dog.rescued}">Text ...</td>
<td th:text="${dog.vaccinated}">Text...</td>
</tr>

Outlook add 1px right to cell image

I'm using outlook 2013 and I want to create email signature.
When I finished coding I found a 1px gap appear right to the image inside a table cell.
I gave that cell a background color to see if the problem from the image or from the cell itself.
I don't know if it a padding or its a right transparent border.
I search a lot for two days here and in other websites and nothing fixed.
I create another template to demonstrate this gap and here's my code:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<style type="text/css">
table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }
</style>
</head>
<body>
<table width="234" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="117" height="33" style="border-collapse:collapse;padding:0;margin:0;border:none;">
<img src="http://amraymancom.ipage.com/signtures/mazaya/images/mazaya-logo.png" border="0" width="117" height="33" border="0" style="display:block;border:none;"/>
</td>
<td width="117" height="33" style="border-collapse:collapse;padding:0;margin:0;border:none;">
<img src="http://amraymancom.ipage.com/signtures/mazaya/images/mazaya-logo.png" border="0" width="117" height="33" border="0" style="display:block;border:none;"/>
</td>
</tr>
</table>
</body>
</html>
And here's a screenshot to the cell gap:
I know that coding for Outlook is a headache but I would appreciate your help if you explain to me why this gap appear and what should I do to fix this.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<style type="text/css">
table { border-collapse:collapse; mso-table-lspace:0pt; mso-table-rspace:0pt; }
</style>
</head>
<body>
<table width="234" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" width="117" height="33" style="border-collapse:collapse;padding:0;margin:0;border:none;">
<img src="http://amraymancom.ipage.com/signtures/mazaya/images/mazaya-logo.png" border="0" width="117" height="33" border="0" style="display:block;border:none;"/>
</td>
<td align="left" width="117" height="33" style="border-collapse:collapse;padding:0;margin:0;border:none;">
<img src="http://amraymancom.ipage.com/signtures/mazaya/images/mazaya-logo.png" border="0" width="117" height="33" border="0" style="display:block;border:none;"/>
</td>
</tr>
</table>
</body>
</html>
I'd try this. This isn't removing the gap, but I added align="left" to the td's , so the gap will be on the right and not in between. Also I would suggest to save both images as one. This makes sure it will always display correctly and will make loading times faster, as it saves on memory space.
Also since the images are on a white background maybe add them as jpg. For Email signatures its important to save as much space as possible, since you are sometimes mailing to mobile phones and you you send you signature again with each answer in each conversation.

kendoDropDownList resetting inside kendoGrid after sort

I've added a kendoDropDownList in one of the cells in a kendoGrid, and it works fine at first. However, when I click on a column header to sort, the cell loses its formatting. Anyone have any idea how to prevent this? Here's a simple sample:
<html>
<head>
<title>test</title>
<link href="/kendoui.web.2013.2.716.open-source/styles/kendo.common.min.css" rel="stylesheet" type="text/css"/>
<link href="/kendoui.web.2013.2.716.open-source/styles/kendo.default.min.css" rel="stylesheet" type="text/css"/>
<script src="/kendoui.web.2013.2.716.open-source/js/jquery.min.js"></script>
<script src="/kendoui.web.2013.2.716.open-source/js/kendo.web.min.js" type="text/javascript"></script>
</head>
<body>
<table class="gridTable">
<thead>
<tr>
<th data-field="name">Name</th>
<th data-field="options">Options</th>
</tr>
</thead>
<tbody>
<tr>
<td class="wrap">Item</td>
<td>
<select class="menuBar" style="width:80px;">
<option>Big</option>
<option>Medium</option>
<option>Small</option>
</select>
</td>
</tr>
</tbody>
</table>
<script type="text/javascript">
$(document).ready(function() {
$(".gridTable").kendoGrid({
sortable: true
});
$(".menuBar").kendoDropDownList({
});
});
</script>
</body>
</html>
The Grid is reconstructed each time you perform Page/Sort/Group etc. For such cases you need to use the dataBound event of the Grid to re-initialize any widgets or executed any JavaScript code that affects what is displayed in the Grdi.

Resources