lundi 23 avril 2018

VB - If does not work in Timer

I've created a Timer in VB, my intention is that the Timer stops if a string equals another string. I am using Awesomium and I am trying to get the Value of an element on the website. The basic query works, I added "Label4.Text" to test if there is a value for AnswerOpacity at all and now Label4's text is "opacity: 1;" but the if statement doesnt get triggered. Do you know why?

 Private Sub AnswerTimer2_Tick(sender As Object, e As EventArgs) Handles AnswerTimer2.Tick

    AnswerOpacity = Form1.WebControl1.ExecuteJavascriptWithResult(String.Format("document.querySelector('#snipTextIcon').getAttribute('style');"))

    Label4.Text = Form1.WebControl1.ExecuteJavascriptWithResult(String.Format("document.querySelector('#snipTextIcon').getAttribute('style');"))
    If AnswerOpacity = "opacity: 1;" Then


        Label3.Text = "Answer Timer GESTOPPT"
        MsgBox("Answer erhalten")
        AnswerOpacity = ""
        AnswerTimer2.Stop()

    End If

End Sub

Aucun commentaire:

Enregistrer un commentaire