資産一覧画面のHTMLソース(一部を抜粋)は以下のようになっています。
<html>
<head></head>
<body>
<table>
<table></table>
<table></table>
<table></table>
<table>
<table></table>
<table>
<tr>
<th><nobr>注文</nobr></div></th>
<th><nobr>銘柄</nobr></div></th>
<th><nobr>保有数量</nobr><br><nobr>うち執行中数量</nobr></div></th>
<th><nobr>平均取得価額</nobr><nobr>[円]</nobr></div></th>
<th><nobr>現在値[円]</nobr><br><nobr>時価評価額[円]</nobr></div></th>
<th><nobr>評価損益[円]</nobr><br><nobr>評価損益率</nobr></div></th>
<th><nobr>取引明細</nobr></div></th>
</tr>
<tr align="right">
<td>
<div>
<nobr><img src="xxx"><a href="xxx">買い</a></nobr><br>
<nobr><img src="xxx"><a href="xxx">売り</a></nobr>
</div>
</td>
<td>
<div>
<nobr>ジパング</nobr><br>
<nobr>2684</nobr>
</div>
</td>
<td>
<div>
<nobr>10 株</nobr><br>
<nobr>0 株</nobr>
</div>
</td>
<td>
<div>
<nobr>2,000.00</nobr>
</div>
</td>
<td>
<div>
<nobr>2,211</nobr><br>
<nobr>663,300</nobr>
</div>
</td>
<td>
<div>
<nobr>0</nobr><br>
<nobr>0.00 %</nobr>
</div>
</td>
<td>
<div>
<nobr><a href="xxx">明細</a></nobr>
</div>
</td>
</tr>
</table>
</table>
<table></table>
<table></table>
<table></table>
</body>
</html>
Public Class AssetList
Inherits AbstructAssetFrame
Implements IWebScreenPaging
Private _pageNo As Integer = 1
Public ReadOnly Property PageNo As Integer Implements IWebScreenPaging.PageNo
Get
Return _pageNo
End Get
End Property
Sub New(ByVal screen As AbstructRakutenWebLoginSession)
MyBase.new(DirectCast(screen, AbstructWebScreen))
End Sub
Function GoOrder(ByVal dt As IDayTrade) As LongSellOrder
Try
FocusMainFrame()
Dim objTable As New IEWrapperFixed(_ie.Element("table", 6))
Dim objTr As IEWrapperFixed = Nothing
For i As Integer = 0 To _ie.Element("tr").length - 1
_ie = objTable.GetIE()
If _ie.IsNothingElement() Then Continue For
objTr = New IEWrapperFixed(_ie.Element("tr", i))
_ie.Element("td", 1)
If _ie.IsNothingElement() Then Continue For
_ie.Element("nobr", 1)
If _ie.IsNothingElement() Then Continue For
If _ie.InnerText Is Nothing Then Continue For
Dim str As String
str = _ie.InnerText
If str = CStr(dt.company_id) Then
For j As Integer = 0 To 1 ' 「買い」「売り」
_ie = objTr.GetIE()
_ie.Element("td", 0)
If _ie.IsNothingElement() Then Continue For
_ie.Element("a", j)
If _ie.IsNothingElement() Then Continue For
If _ie.InnerText Is Nothing Then Continue For
str = _ie.InnerText
If str = "売り" Then
_ie.Click()
Return New LongSellOrder(Me, dt)
End If
Next
End If
Next
If Not GoNext() Is Nothing Then
Return GoOrder(dt)
End If
Catch e As Exception
DispatchException(e, "売り注文検索")
End Try
Throw New WebScreenException("売り注文検索")
End Function
Private Function GoNext() As IWebScreen Implements IWebScreenPaging.GoNext
_pageNo += 1
Return GoNextCommon()
End Function
End Class
スポンサーリンク