Rob56 Posted January 30 Posted January 30 I am successfully using AutoIt to: Open a web page with a table Column 0 has a string which I search on. e.g <td>XXXX</td> Column 1 has <td>elements like this <td> <a href="yyyy" > Some Text</a> </td> Capture the table with this code $oTable = _IETableGetCollection($o,1) $aTableData = _IETableWriteToArray($oTable, True) use $aResult = _ArrayFindAll($aTableData,"XXXX",Default, Default, Default, Default, 0) to get an array of the rows with my SearchString in column 0 I then use $aResult to extract Column 1 for my rows of interest The problem is: All I seem to get is "XXXX" How can I get the full contents of the <td> including the HTML tags?
Solution bogQ Posted January 30 Solution Posted January 30 (edited) Your using _IETableWriteToArray that is using .innerText and as far as i understand from your question you need to use .innerHtml. So what you can do is create your own function and use similar code from original function changing that one thing if that is what you need. As for more things you can do something like this #include <IE.au3> #include <Array.au3> Local $oIE = _IECreate() Local $sHTML = "<h1>test</h1>" $sHTML &= "<table>" $sHTML &= "<tr><th>Company</th><th>Contact</th><th>Country</th><th>Country</th><th>Country</th></tr>" $sHTML &= "<tr><td>Centro comercial Moctezuma</td><td>Francisco Chang</td><td>Mexico</td></tr>" $sHTML &= "<tr><td>Centro comercial Moctezuma</td><td>Francisco Chang</td><td>Mexico</td></tr>" $sHTML &= "<tr><td>Centro comercial Moctezuma</td><td>Francisco Chang</td><td>Mexico</td></tr>" $sHTML &= "<tr><td>Maria Anders</td><td>Maria Anders</td><td>XXXX</td><td>Maria Anders</td><td><a href='#'>test123</a></td></tr>" $sHTML &= "<tr><td>Maria Anders</td><td>Maria Anders</td><td>Centro comercial Moctezuma</td><td>Francisco Chang</td><td>Mexico</td></tr>" $sHTML &= "</table>" _IEBodyWriteHTML($oIE, $sHTML) $oTable = _IETableGetCollection($oIE, 0) $aTableData = _IETableWriteToArray($oTable, True) Local $row = _ArraySearch($aTableData, "XXXX", Default, Default, Default, Default, Default, Default, False) If @error Then MsgBox(0, 'error 1', @error) Local $col = _ArraySearch($aTableData, "XXXX", Default, Default, Default, Default, Default, Default, True) If @error Then MsgBox(0, 'error 2', @error) ConsoleWrite('row: ' & $row & '; col: ' & $col & " | " & $aTableData[$row][$col] & @CRLF) For $x = 0 To UBound($aTableData, 2) - 1 ConsoleWrite($aTableData[$row][$x] & @CRLF) Next _ArrayDisplay($aTableData, "Found") Edited January 30 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now