WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

User Samples

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Selecting a Tab on a Webpage

 Keywords: Select Click Link A Href Tab Div GetElementsByTagName Web Page HTML 

Div.html

<html>
<title>Example Div</title>
<style type="text/css">
      /*Credits: Dynamic DRIVE CSS Library */
      /*URL: HTTP://www.dynamicdrive.com/style/ */

      .mattblacktabs{
      width: 100%;
      overflow: hidden;
      border-bottom: 1px solid black; /*bottom horizontal line that runs beneath tabs*/
      }

      .mattblacktabs ul{
      margin: 0;
      padding: 0;
      padding-left: 10px; /*offset of tabs relative To browser left edge*/
      font: bold 12px Verdana;
      list-style-type: none;
      }

      .mattblacktabs li{
      Display: inline;
      margin: 0;
      }

      .mattblacktabs li a{
      float: left;
      Display: block;
      text-decoration: none;
      margin: 0;
      padding: 7px 8px; /*padding inside each TAB*/
      border-right: 1px solid white; /*right divider between tabs*/
      color: white;
      background: #414141; /*background of tabs (default state)*/
      }

      .mattblacktabs li a:visited{
      color: white;
      }

      .mattblacktabs li a:hover, .mattblacktabs li.selected a{
      background: black; /*background of tabs For hover state, plus TAB with "selected" class assigned To its LI */
      }
</style>


<body>
   <h3>Example Div</h3>
   <div id="ddtabs1" class="mattblacktabs">
      <ul>
         <li><a href="http://www.winbatch.com" rel="sc1">WinBatch</a></li>
         <li><a href="http://www.webbatch.com" rel="sc2">WebBatch</a></li>
         <li><a href="http://techsupt.winbatch.com/" rel="sc3">Tech Database</a></li>
         <li><a href="http://forum.winbatch.com">WinBatch Forum</a></li>
      </ul>
   </div>
</body>
</html>



Div.wbt

url = "D:\temp\Div\div.html"

; Initialize MSIE object
oIE   = ObjectCreate("InternetExplorer.Application")
oIE.Visible = @TRUE ; Change to @FALSE to hide the process from the user
oIE.Navigate(url)

; Wait for webpage to load
While oIE.busy || oIE.readystate<>4
   TimeDelay(1)
EndWhile

; Get document object
;oDoc = oIE.Document

aDivs = oIE.Document.Body.GetElementsByTagName("DIV")
count = aDivs.length
oDiv = aDivs.item(0)
aAnchors = oDiv.GetElementsByTagName("A")

;tab1 = aAnchors.Item(0)
;tab1.click

tab2 = aAnchors.Item(1)
tab2.click


Pause(0,0)
; Close IE
oIE.Quit()

; Close open COM/OLE handles
oDoc = 0
oIE = 0
Exit

Article ID:   W18147
Filename:   Selecting a Tab on a Webpage.txt
File Created: 2013:06:19:13:50:14
Last Updated: 2013:06:19:13:50:14