Testing Multiple Links on a page using a color

So I am trying to test help for a software product which is online. I am not sure if it is possible at the moment without taking a lot of textcaptures which could change a lot since the help files are constently updated.

So what I am trying to do is log the color of a link that has not been clicked (the blue color.). Then on the page click any link using a color search. Verify it went to the right page and then hit back on the browser and reload the webpage and now the link is the red color showing it has been clicked. Then look for the color again and click the color if there are more links.

So basically I want to keep searching for a specific color and if it is found then I want that color to be clicked and repeat this until all the links have been clicked on the page then onto the next page and repeat this process.

I am not sure if there is a way for me to search for a color and then click it. It wouldn't matter how many results would be returned because I would just click the first one and rerun it again.

Comments

  • EggplantMattEggplantMatt ForumAdmin admin
    Two things: First, you could do what you want by capturing just a pixel (or maybe 2 or 3 pixels) and then using the following script structure:
    repeat while imageFound("myPixelSample")
        Click foundImageLocation()
        -- do other stuff
    end repeat
    

    However, my second point would be that you would have better luck if you used the TextImage feature and a data driven testing approach. If you had a file containing a list of the help topics for a given page, you could do something like this:
    repeat with each line of file "helpTopics.txt"
         Click (Text:it, TextFont:"Lucida Sans", TextPlatform:"MacOSX_10.5", TextColor:(52,68,255), TextSize:"10") -- settings for the help viewer text
         if not imageFound(Text:it, TextFont:"Lucida Sans", TextPlatform:"MacOSX_10.5", TextColor:(0,0,0), TextSize:"12")  then -- settings for the title text on the help viewer
               LogError "Bad help link for topic:" && it
         end if
    end repeat
    
    Please let us know if you have any questions about implementing either of these approaches.
Sign In or Register to comment.