I'm stuck with
how to select the Gender (Male / Female) from a dropdown list in a Website. My current script works, apart for the gender part:
It blocks in this line:
doc.getElementById("select2-ContentPlaceHolder1_Gender_Drop-container").Click
I tried GetElementByID and GetElementByClassName for the Gender field but it does not work. I added a value Male, but it doesn't want to appear in the text field, even after adding Click.
Any help would be much appreciated.
how to select the Gender (Male / Female) from a dropdown list in a Website. My current script works, apart for the gender part:
VBA Code:
Sub MERF()
Dim IE As Object
Dim doc As HTMLDocument
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "https://portal.spsc.gov.sa/MEH/Default.aspx?Id=386"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Set doc = IE.document
'IE.document.getElementById("ContentPlaceHolder1_Mr_Txt").Value = "very cute"
doc.getElementById("ContentPlaceHolder1_Event_Date_Txt").Value = Sheet1.Range("F34").Value
doc.getElementById("ContentPlaceHolder1_Wasfaty_Chk_1").Click
Application.Wait Now() + TimeValue("00:00:05")
doc.getElementById("ContentPlaceHolder1_Wasfaty_Other").Value = Sheet1.Range("T34").Value
doc.getElementById("ContentPlaceHolder1_Mr_Txt").Value = Sheet1.Range("B34").Value
doc.getElementById("select2-ContentPlaceHolder1_Gender_Drop-container").Click
doc.getElementById("ContentPlaceHolder1_Event_Desc_Txt").Value = Sheet1.Range("M34").Value
doc.getElementById("ContentPlaceHolder1_txtReporterComment").Value = Sheet1.Range("Q34").Value
doc.getElementById("ContentPlaceHolder1_Reporter_Name_Txt").Value = "name"
doc.getElementById("ContentPlaceHolder1_Reporter_Email_Txt").Value = "mail"
doc.getElementById("ContentPlaceHolder1_Reporter_Mobile_Txt").Value = "xxxx"
End Sub
It blocks in this line:
doc.getElementById("select2-ContentPlaceHolder1_Gender_Drop-container").Click
I tried GetElementByID and GetElementByClassName for the Gender field but it does not work. I added a value Male, but it doesn't want to appear in the text field, even after adding Click.
Any help would be much appreciated.