no ,
as i think webbrowser documentcompleted method is invoked when a button with post back is called using
InvokeMember Method of webbrowser. But in my case the Hyperlink(
ctl00_ContentPlaceHolder1_gvContractDetails_ctl03_btnInsert) i have described above loads on a Button(
ctl00_ContentPlaceHolder1_BtnNew) click without postback
(probably using ajax) . the hyperlink is present inside a gridview .
i am using the following code :
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_TxtLastName").SetAttribute("Value", "sa")
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_TxtFirstName").SetAttribute("Value", "sa")
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_TxtSSN").SetAttribute("Value", "098765431")
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_TxtDOB").SetAttribute("Value", Format(CDate("09/09/1981"), "MM/dd/yyyy").Trim())
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_ddlCurrentDOEEmployee").SetAttribute("Value", "N")
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_TxtAddress1").SetAttribute("Value", "ny 1345")
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_TxtCity").SetAttribute("Value", "Ca")
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_ddlState").SetAttribute("Value", "OH")
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_TxtZipCode").SetAttribute("Value", "12345")
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_TxtPrimaryPhoneNum").SetAttribute("Value", "6565654663")
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_BtnNew").InvokeMember("Click")
System.Threading.Thread.Sleep(10000)
Dim pvoEle As System.Windows.Forms.HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("table")
Dim pviCount As Integer
For pviCount = 0 To pvoEle.Count
If pvoEle.Item(pviCount).Id <> "" Then
MessageBox.Show(pvoEle.Item(pviCount).InnerHtml)
End If
Next
WebBrowser1.Document.All("ctl00_ContentPlaceHolder1_gvContractDetails_ctl03_ddlContract_New").SetAttribute("Value", "311")
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_gvContractDetails_ctl03_ddlContract_New").RaiseEvent("onChange")
System.Threading.Thread.Sleep(10000)
For pviCount = 0 To pvoEle.Count - 1
If pvoEle.Item(pviCount).Id <> "" Then
MessageBox.Show(pvoEle.Item(pviCount).InnerHtml)
End If
Next
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_gvContractDetails_ctl03_ddlWorkSite_New").SetAttribute("Value", "PETSND1***311")
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_gvContractDetails_ctl03_ddlWorkTitle_New").SetAttribute("Value", "5540")
WebBrowser1.Document.All(
"ctl00_ContentPlaceHolder1_gvContractDetails_ctl03_ddlRosterStatus_New").SetAttribute("Value", "A")
WebBrowser1.Document.All("ctl00_ContentPlaceHolder1_gvContractDetails_ctl03_btnInsert").InvokeMember("Click")
System.Threading.Thread.Sleep(20000)
Thanks