Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27156

VS 2010 [RESOLVED] Automate Webpage

$
0
0
Hope someone can help me out. I'm not a web programmer but have inherited a VB.Net 2010 app that automates a website. For the most part, it works great but there is a small problem that I need to fix and haven't had much luck finding a solution on my own. This program logs into a website goes through several menu options, sorts some data and reads it from the table display. The problem is sometimes not all data is on one page and I need to move to the next page. I thought I could execute
Code:

WebBrowser1.Document.GetElementById("Page2").InvokeMember("Submit")

but this does not work. Then I tried to make this work
Code:

Dim theElementCollection AsHtmlElementCollection = Me.WebBrowser1.Document.Window.Frames("principal").Document.All
ForEach curElement AsHtmlElementIn theElementCollection
If curElement.InnerText = "2"Then
If curElement.GetAttribute("value").Equals("Page2") Then
curElement.SetAttribute("value", "2")
curElement.InvokeMember(
"click")
While WebBrowser1.IsBusy
EndWhile
EndIf
EndIf
Next

Here's the html
Code:

<p align=center><input type="submit" value="Page2" name="BSCROLL"><input type="submit" value="Page28" name="BSCROLL">
    <br><br><nobr>
    <script>
    function BSCROLLselect(s){
    var bscroll=s.form.BSCROLL[s.form.BSCROLL.length-1];
    bscroll.value=s.value;
    bscroll.disabled=s.value=="Page1";
    }
    </script>
    <select onchange="BSCROLLselect(this)">
    <option value="Page1" selected>1</option><option value="Page2">2</option><option value="Page3">3</option><option value="Page4">4</option><option value="Page5">5</option><option value="Page6">6</option><option value="Page7">7</option><option value="Page8">8</option><option value="Page9">9</option><option value="Page10">10</option><option value="Page11">11</option><option value="Page12">12</option><option value="Page13">13</option><option value="Page14">14</option><option value="Page15">15</option><option value="Page16">16</option><option value="Page17">17</option><option value="Page18">18</option><option value="Page19">19</option><option value="Page20">20</option><option value="Page21">21</option><option value="Page22">22</option><option value="Page23">23</option><option value="Page24">24</option><option value="Page25">25</option><option value="Page26">26</option><option value="Page27">27</option><option value="Page28">28</option>
    </select><input type="submit" disabled value="Page1" name="BSCROLL">
    </nobr>
    </p>

Anyone know what I'm doing wrong? Thanks in advance.

Viewing all articles
Browse latest Browse all 27156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>