【发布时间】:2015-02-11 08:48:00
【问题描述】:
我想从网站上提取一些数据并将其放入 excel 中。我之前已经这样做过,并且编写了让我登录并浏览到我想要的页面的代码。
不过,此时网站的格式有所不同。我想要的页面有框架。顶部框架有一个横幅和一些文本,然后在底部框架中有一个表格。当我在我的 VBA 代码中浏览到这一点时,它似乎只找到顶部框架 - 没有表单等。我如何专门针对带有表单的框架?
HTML 源代码:
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="../custom/LeftSideSquareTabs.css">
<script type="text/javascript" language="javascript" src="../include/JSCommon.js"></script>
<Script language="JavaScript">
function Dummmy()
{
parent.location.replace('../login.asp?Locale=EN&Lo=1')
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="10">
<table border="0" cellpadding="0" cellspacing="0" width="786">
<tr>
<td width="50%" align="left" height="62"></td>
<td width="50%" align="right" height="62">
<a href="http://www.website.com" target="_blank">
<img name="ToolbarRightLogo" src="../custom/ToolbarlogoRight.gif" border="0" alt="MMIA version 5.1.0">
</a>
</td>
</tr>
</table>
<table width="786" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="TabsOff" onclick="dispayMen();">Option A</td>
<td class="TabsImage"><img src="../images/TabOff.gif" width="4" height="17"></td>
<td><img src="../images/spacer.gif" width="1" height="1"></td>
<td class="TabsOn">Option B<</td>
<td class="TabsImage"><img src="../images/TabOn.gif" width="4" height="17"></td>
<td><img src="../images/spacer.gif" width="1" height="1"></td>
<td><img src="../images/spacer.gif" width="466" height="1" WIDTH="1" HEIGHT="1"></td>
<td class="SupportOff" onMouseOver="this.className='SupportOver'" onMouseOut="this.className='SupportOff'" onclick="LogOutSession()">Log out</td>
<a href="mailto:support@xxxxx.com"><td class="Support" onMouseOver="this.className='SupportO'" onMouseOut="this.className='Support'">Contact</td></a>
<td><img src="../images/spacer.gif" width="10" height="1"></td>
</tr>
<tr>
<td class="TabsOffBottom" colspan="2"><img src="../images/spacer.gif" width="1" height="1"></td>
<td class="TabsOnBottom" colspan="3"><img src="../images/spacer.gif" width="1" height="1"></td>
<td class="TabsOffBottom" colspan="7"><img src="../images/spacer.gif" width="1" height="1"></td>
</tr>
</table>
<table class="TabsOnBottom" width="786" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="TabsOffBottom"><img src="../images/spacer.gif" width="1" height="1"></td>
<td><img src="../images/spacer.gif" width="9" height="8"></td>
<td class="MiddleToolbarText" width="526">Option B</td>
<td class="MiddleToolbarRightText" width="185">Updated to: </td>
<td class="MiddleToolbarText" width="55">11-02-2015</td>
<td><img src="../images/spacer.gif" width="9" height="1"></td>
<td class="TabsOffBottom"><img src="../images/spacer.gif" width="1" height="1"></td>
</tr>
</table>
<table class="TabsOnBottom" width="786" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="TabsOffBottom"><img src="../images/spacer.gif" width="1" height="1"></td>
</tr>
</table>'
【问题讨论】:
-
没有HTML源几乎不可能回答这个问题,请补充。
-
我已经添加了被抓取页面的源代码。此代码不包含我希望废弃的数据。 “选项 B”似乎是我需要的选项....我可以在屏幕上看到数据,但不是在那个源代码中。
-
以上 HTML 中没有框架。
标签: vba excel web-scraping frames