I am writing a script to copy and paste content off a site. The idea is that the page is updated via javascript, the content is copied and pasted and then then the site is updated again.

Unfortunately with the example code below, I only get the first page repeated again and again. I am not sure what the problem is, but I think that there is not enough time for the page to update before the content is copied.

Can anyone suggest a way that will allow the page to update before carrying out the update feature? This seems trickier because of the javascript

Thanks


WebBrowser1.Document.InvokeScript("__doPostBack", New Object() {"dnn$ctr958$CE_ActiveSocial_Contacts$GridView1", "Page$1"})




WebBrowser1.Select()
Application.DoEvents()
SendKeys.Send("^a")
SendKeys.Send("^c")

pString = Clipboard.GetText()

aWrite = New StreamWriter(qString)
aWrite.Write(pString)
aWrite.Flush()
aWrite.Close()

WebBrowser1.Document.InvokeScript("__doPostBack", New Object() {"dnn$ctr958$CE_ActiveSocial_Contacts$GridView1", "Page$2"})

WebBrowser1.Select()
Application.DoEvents()
SendKeys.Send("^a")
SendKeys.Send("^c")

pString = Clipboard.GetText()

aWrite = File.AppendText(qString)
aWrite.WriteLine(pString)
aWrite.Flush()
aWrite.Close()