Crossbrowser Object mapping: Object correctly detected in one browser not detected in the second
just a post about something I've noticed when working with mapped object between Firefox and Chrome. I was having issues getting some mapped objects to be detected in the second browser having mapped successfully in the first.
In all cases I was using some text property, e.e. innerText, to identify the object and there appeared to be no difference in the text property between the two browsers, when I examinded using object spy etc., and hence no obvious reason why the mapped object could not be found by testcomplete in the second browser
What I have discovered after trial and error is that there appear to be unseen/invisible characters within the text property itself and that this is why testcomplete cannot identify the object in the second browser. Workaround I have found is to delete the extra invisible characters and also to wildcard the beginning and end of the text string.
In namemapping editor select the object and open the edit object properties dialog, select the property and click the edit icon, object property edit dialog is presented.
Click at the start of the string and use the "Delete" button on keyboard to remove any unseeen characters that may be occurring at the start of the string. (presence of unseen chars at start of a string is noticeable in that the cursor does not move even though the key has been pressed, until all unseen chars have been deleted at which point the string characters will then start to be deleted)
Click at the end of the string to move the cursor and use both the Delete and Backspace keys to remove any potential unseen chars at the end of the string. (presence of unseen chars at end of a string is most noticeable when using Backspace, the cursor does not move even though the key has been pressed, until all unseen chars have been deleted at which point the text string characters will start to be deleted)
e.g. I have a dialog with titie bar text Add task, which was not being detected by testcomplete in the second browser. I edited the innerText property value, performed the deletion and saved the changes. The dialog was then detected in the second browser.
Ocassionally deletion of the unseen/invisible chars does not work and the object still cannot be found by testcomplete in the second browser. In these cases I also add wildcards to the beginning and end of the text string, after performing the deletion steps, and the mapped object is then correctly detected in the second broswer. For example: *Addtask*
Hope this is of help to someone out there trying to figure out why your mapped objects are not being detected between different browsers. And if anyone can shed some light on what exactly is happening to create the unseen/invisible characters in the mapped object property I'd love to hear about it.
Also, consider using contentText rather than innerText for identification if you are doing cross-browser testing. innnerText isn't always available in all browsers, in which case you may have to use something like textContent. TestComplete does the legwork to reconcile these discepancies into the contentText so you don't have to to tests for which browser you are working with when trying to identify an object
Standard syntax disclaimers apply
Thanks for the tip, wasn't sure what the differnce between contexttext and innertext was
/Alex [Community Hero]
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.