Unable to find the complete text in Firefox

Hi,

I have to perform cross browser testing using Eggplant. Infact I have automated the complete framework using Safari Browser. Now I am modifying the existing framework in such a way that it should run on both Safari and Firefox browser(Version 3.0.10). But the problem is most of the times, Eggplant is not able to recognize the complete text. For example, if I want to recognize the text “New Search”, I am able to do in Safari but in the case of Firefox its not working.

It can work in Firefox with this code:

Click(Text:“earch”,TextSize:11,TextFont:“Verdana”)

but this code is failing:

Click(Text:“New Search”,TextSize:11,TextFont:“Verdana”)

Any suggestions why it is able to recognize some part of word instead of the complete word and what can we do to make it recognize the complete word?

This is almost certainly because of the way Safari is rendering the fonts; my guess is that it is using it’s own rendering engine rather than the system’s rendering routines, which is what Eggplant uses to render text. The problem is likely to be that when Safari renders the text, it is putting an extra pixel or two of space after the capital letters and perhaps between the words as well – unfortunately, there’s currently no easy fix for this issue.

You can try decreasing the point size by a quarter to a half a point, using 10.75 or 10.5 instead of 11. You might also try using a “discrepancy” search which allows a small percentage of pixels to be completely different. This would look like this:

Click(Text:"earch",TextSize:11,TextFont:"Verdana", Discrepancy:2%)

(If you bump the discrepancy value higher than 2% you’re like to get false matches.) The caveat is that while this might help in some cases, it’s unlikely that it will solve the problem for every text string that you have. It’s also much more likely to work for a single capitalized word than for a multi-word string.

If these suggestions don’t help, it’s also possible to script more elaborate workarounds that break up multi-word strings and look for the individual words or even look for individual characters. We hope that in a future version of the TIG feature we’ll be able to offer more control over the spacing, but I can’t say when that will happen.

Another thing I find helpful for TIG is to use the Trim:true
I found this solved the odd problem for me when searching for words especially if there is other text that is real close to it.