Need to verify that some text & login button exists or n

Hi,

I need to verify that some text and button (Mandatory verification for my app) exists are not…

How to verify that particular things? I can use work around that If ImageFound() but I need little more specific… Is there any way to verify this?

Thanks
chandra

Chandra,

It is a little unclear what you are trying to accomplish. Can you explain in more detail?

Using ImageFound() is a good way to verify whether or not an image is on screen at the time of the search. You can use the OCR as part of an ImageFound() function. To read about tips and tricks when using the OCR, you can read through this helpful Knowledge Base post: http://www.testplant.com/support/2012/02/working-with-ocr/

So, your code could look like this if you want:

if imageFound (text:"Some Text", SearchRectangle:("TLCorner","BRCorner"))
Then
//Do Something
End If

If you are trying to verify that an image is not on screen, you can use

if not imageFound("SomeImage")

If this is not helpful information to you, please clarify your situation. What is it exactly that you’re trying to verify?

-Elizabeth

Hi Elizabeth,

Presently i am doing in a way which you explained (Image found)… But i dont want verify the whole screen. On the Home screen, it should verify that ‘Register’ and ‘Login Button’ exists… If there, then it should proceed my test script else it should not be proceeded and quit the code

Thanks
Chandra

Chandra,

The code I mentioned previously will verify buttons such as ‘Register’ and ‘Login’ buttons, not the entire screen. It is necessary for it to search the entire screen for those button images unless you specify a search rectangle like I did in the first code example, though this is usually more helpful for text searches using the OCR feature than when looking for images.

You can set the search rectangle like this:

if imageFound ("Register", SearchRectangle:(100,100,200,200))

You can use “exit all” within an if/then conditional statement to exit the script when the image(s) is/are not found:

--This script assumes you need to click the "Register" button in order to see the "LoginButton" image:
if imageFound ("Register") 
then 
	click it //Or do something else
	if imageFound ("LoginButton") 
	then 
		pass message and continue
end if
else 
exit all
end if

--You can also use a simpler code if you only need to look for one image:
if imageFound ("Register") 
then 
	//Do Stuff
else 
	exit all -- this will exit your script. You can read more about this command in the SenseTalk Reference manual
end if

My apologies, I realized there is an error in the script I posted.
I wrote:

if imageFound("Register")
then
      click it//or do something else

“Click it” in this scenario will not work. Instead you must use foundImageLocation, as in the below code:

if imageFound("Register")
then
      click foundImageLocation()

-Elizabeth

Sounds clear…Cheers!!!

Thanks
Chandra