Consulting

Results 1 to 11 of 11

Thread: Can't find "div class" element

  1. #1
    VBAX Regular
    Joined
    Mar 2017
    Posts
    13
    Location

    Can't find "div class" element

    Hey guys,

    I was able to click through a betting website from the very beginning until I got there: https://www.bet365.com/?&cb=10325422...7585416/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
    Attached Images Attached Images
    • File Type: jpg a.JPG (150.4 KB, 11 views)

  2. #2
    VBAX Regular
    Joined
    Mar 2017
    Posts
    13
    Location
    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

    b.JPG

  3. #3
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Quote Originally Posted by Yamadori View Post
    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"
    ?
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  4. #4
    VBAX Regular
    Joined
    Mar 2017
    Posts
    13
    Location
    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...

  5. #5
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Let's have the rest of the code then.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  6. #6
    VBAX Regular
    Joined
    Mar 2017
    Posts
    13
    Location
    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

  7. #7
    VBAX Regular
    Joined
    Mar 2017
    Posts
    13
    Location
    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

  8. #8
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    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.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  9. #9
    VBAX Regular
    Joined
    Mar 2017
    Posts
    13
    Location
    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?!

  10. #10
    VBAX Regular
    Joined
    Mar 2017
    Posts
    13
    Location
    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?!


  11. #11
    Banned VBAX Newbie
    Joined
    Oct 2022
    Posts
    1
    Location
    Quote Originally Posted by Yamadori View Post
    Hey guys,

    I was able to click through a betting website from the very beginning until I got there: https://songlyricsking.com/game/teen...150-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 ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •