'Excel VBA using Selenium - Select Chrome Web DropDown List

Complete my VBA code before the "EndIf" line. Please help me select the Gender from below Target Inspect HTML code . Below is my code which I have written till now. Please help to complete it.

Sub google_search()
    Dim row As Integer
    row = 2
    Dim bot As WebDriver
    Set bot = New WebDriver
    bot.Start "chrome"
    bot.Get "https://abcd.com/"     



    bot.FindElementbyName("patient_name").SendKeys "Value"
    bot.FindElementbyName("patient_id").SendKeys "Value"

    If Sheet1.Cells(row, 4) = "Years" Then
       bot.FindElementById("age_year").Click
       bot.FindElementbyName("age").SendKeys "Value"
    Else
    If Sheet1.Cells(row, 4) = "Months" Then
       bot.FindElementById("age_month").Click
       bot.FindElementbyName("age").SendKeys "Value"
    Else
    End If
    End If

    If Sheet1.Cells(row, 6) = "M" Then
    
        ...........................................................
        
    End If

 


    Stop

    End Function

Target Site as this inspect

<div class="form-group">

<label for="gender">Gender</label><span class="text-danger"><b> *</b></span>

<select name="gender" id="gender" class="form-control">

<option value="">Select Gender</option>

<option value="M">Male</option>

<option value="F">Female</option>

<option value="T">Transgender</option>

</select>

</div>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source