2

Tried the below code for following URL Scripture look up. Please how to change drop down value from WEB to RV1909?

Dim Doc As HTMLDocument
Set Doc = IEApp.document

TestV2 = ""
TestV3 = ""

TestV2 = Doc.getElementsByClassName("app-list text-list")(0).innerText
Debug.Print "4b of 5: " & TestV2    

IEApp.Doc.getElementsByClassName("app-list text-list").selectedIndex = 1
IEApp.Doc.getElementsByClassName("app-list text-list").FireEvent ("onchange")

TestV3 = Doc.getElementsByClassName("app-list text-list")(0).innerText
Debug.Print "4c of 5: " & TestV3

Tried many approaches from other posts, the following does not work:

IEApp.Doc.getElementsByClassName("app-list text-list")(0).innerHTML = "RV1909"

Here is the screenshot of Chrome Inspector:

Screenshot of Chrome Inspector

2 Answers 2

1

In this case it's not enough just change div.app-list.text-list element innerText, as you can see that element is simple div, but not even ul. It should be changed by scripts which are called on click events. So, first of all you need to click on div to display the entire list, and then click on the RV1909 item. The below example shows how that could be done:

Sub Test()

    Dim oIE As Object
    Dim oDiv As Object

    Set oIE = CreateObject("InternetExplorer.Application")
    With oIE
        .Visible = True
        .Navigate "http://ebible.org/study/"
        Do While .readyState <> 4 Or .Busy
            DoEvents
        Loop
        With .Document
            Do While .readyState <> "complete"
                DoEvents
            Loop
            Set oDiv = .getElementsByClassName("app-list text-list")(0)
            oDiv.Click
            Do While .readyState <> "complete"
                DoEvents
            Loop
            For Each oNode In .getElementsByClassName("text-chooser-main")(0).getElementsByClassName("text-chooser-abbr")
                If oNode.innerText = "RV1909" Then
                    oNode.Click
                    Do While oDiv.innerText <> "RV1909"
                        DoEvents
                    Loop
                    Exit For
                End If
            Next
        End With
    End With

End Sub
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for the solution.
0

Change the html div element <div class=app-list text-list>WEB</div> to <div class=app-list text-list>RV1909</div>

2 Comments

Please, how would I modify this to change the DIV IEApp.Doc.getElementsByClassName("app-list text-list")(0).Value = "RV1909"
Tried many approaches from other posts, the following does not work: IEApp.Doc.getElementsByClassName("app-list text-list")(0).innerHTML = "RV1909"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.