
Here I’am checking if
WebBrowserEx1.Document.All.Item(t).OuterHtml is equal to abc but despite that they are same, it doesnt accept them same and does not perform the code in if statement. The blind one is me or Visual Basic ?
Big Pic : https://i.stack.imgur.com/hVjpH.png
Edit:
For t = 1 To WebBrowserEx1.Document.All.Count
Dim abc = "<LI style=""PADDING-BOTTOM: 2px; PADDING-TOP: 2px"">Hata oluştu. İşlem tamamlanamamıştır. "
If WebBrowserEx1.Document.All.Item(t).OuterHtml = abc Then
WebBrowserEx1.Navigate("http://uyg.sgk.gov.tr/vizite/tarihGiris.do")
loc = "giris"
WebBrowserEx1.Update()
yeniSayfa = True
Exit For
End If
Next
Value of WebBrowserEx1.Document.All.Item(t).OuterHtml in watch:
“Hata oluştu. İşlem tamamlanamamıştır. “
The Value of abc in watch:
“Hata oluştu. İşlem tamamlanamamıştır. “
I think big pic should be more explanatory.
Second try with type correction
For t = 1 To WebBrowserEx1.Document.All.Count
Dim abc As String
abc = "<LI style=""PADDING-BOTTOM: 2px; PADDING-TOP: 2px"">Hata oluştu. İşlem tamamlanamamıştır. "
If WebBrowserEx1.Document.All.Item(t).OuterHtml = abc Then
WebBrowserEx1.Navigate("http://uyg.sgk.gov.tr/vizite/tarihGiris.do")
loc = "giris"
WebBrowserEx1.Update()
yeniSayfa = True
Exit For
End If
Next
Note the type of each object in the right column. Since abc variable is of type “Object”, the
=operator is checking for reference equality. The object referred to by abc may be a string, but since the variable is merely typed as an Object, you get the reference comparison. Since those two objects do not refer to the same block of memory, the compare returnsFalse. Change yourabcdeclaration to look like this:Some other things to look for: