Struggling to navigate a dropdown box using VBA with Selenium? Specifically, trying to select the option value of "BO_test" and click on it? Here's some sample code that I've been experimenting with:
Option Explicit
Private ch As Selenium.ChromeDriver
Sub test()
Dim FindBy As New Selenium.By
Dim ResultSections As Selenium.WebElements
Dim ResultSection As Selenium.WebElement
Dim ResultSections2 As Selenium.WebElements
Dim ResultSection2 As Selenium.WebElement
Dim TableByTag As Selenium.WebElement
Dim tr, c, r, td, li, cc, t, columnC, rowc
Dim size As Integer
Dim currentWindow As Selenium.Window
Dim html As HTMLDocument
Set ch = New Selenium.ChromeDriver
ch.Start baseUrl:=""
ch.Get "/"
With ch
Set ResultSections2 = .FindElementsById("SPFrameWorkTable")
For Each ResultSection2 In ResultSections2
Application.Wait Now + TimeValue("00:00:2")
'Debug.Print ResultSection2.Text
.FindElementById("AQPanelQueryList").Click
.FindElementById("SPSideContainerTD").Click
Next ResultSection2
End With
end sub
This is the output from the debug: Query Management Query: (add new query) BO_test Set As Default Run query when selected Clear form when selected Conditions: Match AllMatch Any Additional Fields Selection
---HTML---
<lable class="SPLayoulTable" cellspacing="0" cellpadding="0">
<tbody
+ <tr> </tr>
}<tr> </tr>
<tr>
<td>
<div id="SPFormDiv" class="SPFormDiv" style="width: 350px; height: 782px; overflow: auto;"> == $0
<table aginfotop="truc" class"SPLayoutTable" id="AQContentTable">
<tbody>
<tr>
<td style="width: 20%">...</td>
<td align="left" style="width: 80%">
(select id="AQranclQueryList">
<optgroup label="My Queries">
<option value="(new)">(add new query)</option>
<option value="7c5a41f1-bala-444a-b7d0-97f5c1ce5052">BO_test</option>
</optgroup>
</select>
</td>
</tr>
* <tr> </tr>
<tr> </tr>