Page 1 of 1

ComObjCreate how read out this

Posted: 02 Feb 2020, 04:20
by tm6464
Hello everyone

On a website there are two posible stats and i wanna check if there is currenty red or green
red
Image
green
Image

Code: Select all

status := % wb.document.getElementsByClassName("info-crc").text
tooltip, %status%
Sleep, 10000
If status = red
{
tooltip, red
Sleep, 10000
return
}
If status = green
{
tooltip, green
Sleep, 10000
return
}

Re: ComObjCreate how read out this

Posted: 02 Feb 2020, 14:07
by TLM
Try changing the conditional statements to: If InStr( status, "red" ) and If InStr( status, "green" ).
Instr() will check if either words reside within status.

Also remove the % from status like this: status := wb.document.getElementsByClassName("info-crc").text

Re: ComObjCreate how read out this

Posted: 02 Feb 2020, 14:59
by teadrinker
getElementsByClassName returns an array-like object, in addition in pure js elements don't have a "text" property. So must be status := wb.document.getElementsByClassName("info-crc")[0].innerText. Perhaps [0] needs to be changed to [1] or [2] and so on, depending on the number of elements with className "info-crc".