I'm trying to automatically click a radio button on a webpage. Here's the relevant HTML code:
I want to click the radio button in the second TD.
I can't use the element ID because I intend to use the same macro on other webpages of the same type where the ID and value differ but the layout is identical.
On the webpage GUI, this is as simple as clicking the radio button located beside text "RW B".
I've been attempting to get the macro to latch on to the previous TD with innerhtml "RW B" and then click the INPUT item within the next TD tag.
So far, I've tried the following with no success:
Here's more HTML code from the page all the way up to the original div:
</tr></tbody></div>
HTML:
RW B
I can't use the element ID because I intend to use the same macro on other webpages of the same type where the ID and value differ but the layout is identical.
On the webpage GUI, this is as simple as clicking the radio button located beside text "RW B".
I've been attempting to get the macro to latch on to the previous TD with innerhtml "RW B" and then click the INPUT item within the next TD tag.
So far, I've tried the following with no success:
Code:
1
For Each ele In objIE.Document.getElementsByTagName("span")
If ele.innerHTML Like "RW B" Then
ele.NextSibling.FireEvent ("*******")
End If
Next
Code:
2
For Each ele In objIE.Document.getElementsByTagName("span")
If ele.innerHTML Like "RW B" Then
ele.NextSibling.Children(0).FireEvent ("*******")
End If
Next
Code:
3
Var element = objIE.Document.querySelector("input[*******^='SetAccessLevel('B','RW'']")
Code:
4
For Each ele In objIE.Document.getElementsByTagName("td").
If ele.innerHTML Like "RW B" Then
ele.NextSibling(0).Firevent ("*******")
End If
Next
Code:
5
Set objInputs = objIE.Document.getElementsByTagName("input")
For Each ele In objInputs
If Left(ele.*******, 23) = "SetAccessLevel('B','RW'" Then
ele.Focus
ele.Click
End If
Next
HTML:
Group Name
Access Rights
Owners
Group RW B
RW B