我有一个官方Webform,我想使用VBA自动进行。我可以成功登录该网站,填写表格,但是当我最终提交该表格时,它不起作用。我已经尝试了几乎所有东西。请帮帮我。
我想通过循环执行此操作,但出于练习目的,我已删除了循环。这是供参考的代码:
Sub Webscript()
Dim LastRow As Long, iRow As Long
iRow = 2
LastRow = Cells(Rows.Count, "E").End(xlUp).Row
Dim sec
sec = 1
Dim driver As New ChromeDriver
With driver
.Start ("chrome")
.Get "https://extensionreforms.dacnet.nic.in/LoginTest.aspx"
.FindElementById("ContentPlaceHolderMain_DDLUsertype").AsSelect.SelectByIndex (2)
.FindElementById("ContentPlaceHolderMain_DDLState").AsSelect.SelectByIndex (20)
.FindElementById("ContentPlaceHolderMain_DDLDistrict").ClickAndHold
.FindElementById("ContentPlaceHolderMain_DDLDistrict").SendKeys ("Sagar")
.FindElementById("ContentPlaceHolderMain_TBDacPasswd").SendKeys ("Atma@Sagar2015")
.FindElementById("ContentPlaceHolderMain_BLogin").Click
.FindElementByLinkText("Beneficiary Registration").ClickAndHold
.FindElementByLinkText("New Beneficiary Registration").Click
.FindElementById("ContentPlaceHolderMain_DDLYear").AsSelect.SelectByIndex (2)
.Wait 2000
.FindElementById("ContentPlaceHolderMain_ddlBlock").ClickAndHold
.FindElementById("ContentPlaceHolderMain_ddlBlock").SendKeys ("Banda") ' Selecting Block
.Wait 2000
.FindElementById("ContentPlaceHolderMain_ddlVillage").ClickAndHold
.Wait 2000
.FindElementById("ContentPlaceHolderMain_ddlVillage").SendKeys ("Bamura Bheda") ' Selecting Village
.Wait 2000
.FindElementById("ContentPlaceHolderMain_RadioButtonList_select_1").Click
.Wait 2000
.FindElementById("ContentPlaceHolderMain_txtOwnerName").SendKeys ("Mahesh sour") 'Farmer Name
.FindElementById("ContentPlaceHolderMain_txtOwnerFather").SendKeys ("pritam sour") 'Father Name
.FindElementById("ContentPlaceHolderMain_ddlrelation").ClickAndHold
.FindElementById("ContentPlaceHolderMain_ddlrelation").SendKeys ("Father") 'Relation
.FindElementById("ContentPlaceHolderMain_ddlGender").ClickAndHold
.FindElementById("ContentPlaceHolderMain_ddlGender").SendKeys ("M") 'Gender
.FindElementById("ContentPlaceHolderMain_txtdob").SendKeys ("") 'Date of Birth
.FindElementById("ContentPlaceHolderMain_txtage").SendKeys ("49") 'Age
.FindElementById("ContentPlaceHolderMain_ddlCatagory").SendKeys ("Others") 'Category
.FindElementById("ContentPlaceHolderMain_txtaddress").SendKeys ("bamura bheda") 'Address
.FindElementById("ContentPlaceHolderMain_txtpincode").SendKeys ("") 'Pincode
.FindElementById("ContentPlaceHolderMain_txtMob").SendKeys ("9999999999") 'Mobile
.FindElementById("ContentPlaceHolderMain_ddlTypeoffarmer").SendKeys ("No Type") 'Type of Farmer
.FindElementById("ContentPlaceHolderMain_ddlOtherId").SendKeys ("Aadhaar No") 'ID Proof *
.FindElementById("ContentPlaceHolderMain_txtUidNo").SendKeys ("306062746198") 'Aadhar No.
.Wait 1000
.FindElementById("ContentPlaceHolderMain_CheckBox_AadharConsent").Click
.Wait 1000
.FindElementById("ContentPlaceHolderMain_btnsubmitnew").Click
.Wait 10000
End With
End Sub