Sign in to follow this  
Followers 0
jeroen96

search for text in IE

4 posts in this topic

#1 ·  Posted (edited)

hello,

I am new to autoit and i want to search for a certain sentence in the html of a website.

the sentence is: <span id="wood" title="Hout - 45 per uur" class="res">849</span>

but when i use

Global $tekst = _IEBodyReadHTML ($oIE)
If StringInStr ($tekst,"<span id={Asc 34}wood{asc 34} title={asc 34}Hout - 45 per uur{asc 34} class = {asc 34}res{asc 34}>849</span") Then
   MsgBox (0,"Found!","The text was found!",3)
Else
   MsgBox (0,"Failed!","The text was not found!",3)
EndIf
it does not find the string.
I tried some things and i think it has something to do with the {asc 34}
I hope someone can help me!
Edited by SmOke_N
put code in code block

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

try this:

StringInStr($tekst, '<span id="wood" title="Hout - 45 per uur" class="res">849</span')

EDIT: Also, welcome to the AutoIt forum. :)

Using code tags will greatly help us look at a problem quickly, like so: [ autoit ] ; code here [ /autoit ] (remove spaces)

Local $var = "test" ; test
Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

thank you!

i did not know it was that simple haha :)

i also have another question, the 849 is variable on the internet,

how can i use that variable in my script?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0