View Full Version : Can't find "div class" element
Yamadori
06-25-2018, 12:35 PM
Hey guys,
I was able to click through a betting website from the very beginning until I got there: https://www.bet365.com/?&cb=10325422098#/AC/B1/C1/D56/E37585416/F2/I0/
This is a table with different match options. If you click on a bet option (here: "2.15") a windows appears where you can insert your stake and finally place the bet. Unfortunately, I'm not able to identify this input field in order to place the stake value I want.
The HTML tells me the input field is a "div class" element with the content: "bs-Stake". I've attached a screenshot of the field I'd like to identy/fill.
I tried a lot of things but didn't find a solution. I thought it's something like ie.documents.getElementByClassName("bs-Stake") but it seems like I'm wrong...
Thanks in advance!
Best regards,
Michael
Yamadori
06-26-2018, 08:15 AM
Hey guys,
I've just realized the direct link doesn't work. If you still wanna help me please click your way through the homepage:
Sport  --> Fußball --> Dänemark --> Dänemark - Superligaen -->  Wettmögl. ändern --> Tore mehr als/weniger als --> Click on any  bet option
This brings you to the screenshot I've attached on the  post before. The HTML for this input I'd like to find is inserted below.
It would be great if you could help my to proceed with my project.
Michael
22477
p45cal
06-26-2018, 01:11 PM
The HTML tells me the input field is a "div class" element with the content: "bs-Stake". I've attached a screenshot of the field I'd like to identy/fill.
I tried a lot of things but didn't find a solution. I thought it's something like ie.documents.getElementByClassName("bs-Stake") but it seems like I'm wrong...
Not being very knowledgeable about these things, isn't the string:
"stk bs-Stake_TextBox"
rather than:
"bs-Stake"
?
Yamadori
06-26-2018, 01:24 PM
This is true, I've copied the wrong class. But even with a code like: 
ie2.Document.getElementsByClassName("stk bs-Stake_TextBox") I can't find the field...
p45cal
06-26-2018, 02:14 PM
Let's have the rest of the code then.
Yamadori
06-27-2018, 05:21 AM
All right, here's the code, only the very end is important. Since I'm not able to find the input field the MsgBox doesn't bring any result
Sub betdreisechsfuenf()
    Dim bethomepage As String
    Dim ie2 As Object
    Dim ele As Object
    Set ie2 = CreateObject("InternetExplorer.Application")
    Dim p As Integer
    Dim o As Integer
        
    bethomepage = "https://www.bet365.com/?&cb=105802124407#/HO/"
    ie2.navigate bethomepage
    ie2.Visible = True
     
    Do While ie2.Busy And Not ie2.readyState = 4
        DoEvents
    Loop
    
    DoEvents
    Set HTMLDoc = ie2.Document
    Set Items = HTMLDoc.all
    
    Application.Wait Now + TimeSerial(0, 0, 2)
        Application.StatusBar = "Suche Fußball"
        For Each ele In ie2.Document.getElementsByClassName("wn-Classification_FavIcon ")
            If InStr(ele.ParentElement.textContent, "Fußball") > 0 Then
                ele.ParentElement.Click
            End If
        Next
AlleSpiele:
    For Each Item In Items
        Set QFields = Item.all
            For Each QField In QFields
                Application.StatusBar = "Suche Liga"
                If InStr(QField.outerHTML, "Dänemark") > 0 And InStr(QField.className, "sm-Market_HeaderClosed ") > 0 Then
                    QField.Click
                    GoTo Ligaauswahl
                End If
            Next QField
    Next Item
Ligaauswahl:
    For Each Item In Items
        Set QFields = Item.all
            For Each QField In QFields
                Application.StatusBar = "Suche Liga"
                If InStr(QField.outerHTML, "Dänemark - Superligaen") > 0 Then
                    QField.Click
                    p = p + 1
                    If p < 2 Then
                        GoTo Ligaauswahl
                    End If
                End If
            Next QField
    Next Item
Spiel:
    For Each Item In Items
        Set QFields = Item.all
            For Each QField In QFields
                Application.StatusBar = "Suche Wettart"
                If InStr(QField.className, "cm-CouponMarketGroup_ChangeMarket ") > 0 Then
                    QField.Click
                    GoTo Wettartüber
                End If
            Next QField
    Next Item
p = 1
Wettartüber:
    For Each Item In Items
        Set QFields = Item.all
            For Each QField In QFields
                Application.StatusBar = "Suche Wettart"
                If InStr(QField.outerHTML, "Tore mehr als/weniger als") > 0 And InStr(QField.className, "wl-DropDownItem") > 0 Then
                    QField.Click
                    GoTo Spielauswahl
                    p = p + 1
                    If p < 2 Then
                        GoTo Wettartüber
                    End If
                End If
            Next QField
    Next Item
Spielauswahl:
p = 1
Application.Wait Now + TimeSerial(0, 0, 2)
    For Each ele In ie2.Document.getElementsByClassName("sl-CouponParticipantWithBookCloses_NameContainer ")
        Worksheets("Polen").Range("B" & p).Value = ele.textContent
        p = p + 1
    Next
    p = 1
Application.Wait Now + TimeSerial(0, 0, 2)
    For Each ele In ie2.Document.getElementsByClassName("gl-ParticipantOddsOnly_Odds")
        If Worksheets("Polen").Range("B" & p).Value <> "" Then
            Worksheets("Polen").Range("C" & p).Value = ele.textContent
        Else
            Worksheets("Polen").Range("D" & p - 8).Value = ele.textContent
        End If
        If p = 1 Or p = 3 Or p = 8 Then
            ele.Click
            Application.Wait Now + TimeSerial(0, 0, 2)
            GoTo Partie:
        End If
        p = p + 1
    Next
Partie:
    
    For Each ele In ie2.Document.getElementsByClassName("stk bs-Stake_TextBox")
        MsgBox ele.textContent
    Next
End Sub
Thanks for any ideas.
Michael
Yamadori
06-28-2018, 07:15 AM
I hope I didn't confuse you. Even if the code is not very, it works for me except the last few lines. Therefore I want to highlight what's doesn't work:
    
For Each ele In ie2.Document.getElementsByClassName("stk bs-Stake_TextBox")
        MsgBox ele.textContent
    Next
Thanks!
Michael
p45cal
06-28-2018, 10:50 AM
I've been trying over an hour or two and I'm not getting anywhere, sorry. I always get no elements.
If you ever solve this one, I'd love to know.
Yamadori
06-29-2018, 12:21 AM
I know, it's a tough one. I'm parsing on websites for a while now and even if mycodes are not very sexy I always found a solution. Not this time. I triedeverything I knew (getElementsByClassName, innerHTML, outerHTML etc.) butnothing worked out.
 
Maybe someone else canhelp us here?!
Yamadori
06-29-2018, 12:51 AM
I know, it's a tough one. I'm parsing onwebsites for a while now and even if my codesare not very sexy I always found a solution. Not this time. I tried everythingI knew (getElementsByClassName, innerHTML, outerHTML etc.) but nothing workedout.
Thanks a lot for your effort though!
Maybe someone else can help us here?!
Dodon
10-29-2022, 11:02 AM
Hey guys,
I was able to click through a betting website from the very beginning until I got there: https://songlyricsking.com/game/teen-patti-bindaas-app-download-get-%e2%82%b955-%e2%82%b9150-per-refer/
This is a table with different match options. If you click on a bet option (here: "2.15") a windows appears where you can insert your stake and finally place the bet. Unfortunately, I'm not able to identify this input field in order to place the stake value I want.
The HTML tells me the input field is a "div class" element with the content: "bs-Stake". I've attached a screenshot of the field I'd like to identy/fill.
I tried a lot of things but didn't find a solution. I thought it's something like ie.documents.getElementByClassName("bs-Stake") but it seems like I'm wrong...
Thanks in advance!
Best regards,
Michael
Hi.  Have you tried asking on Stackoverflow ?
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.