XQuery Question:

Download Job Interview Questions and Answers PDF

How can I find a specific image within a web page?

XQuery Interview Question
XQuery Interview Question

Answer:

To find an image within a web page, you can use one of the following approaches:
► Search for the IMG element whose SRC attribute contains the file name of the desired image. To perform the search, use the Page.NativeWebObject.Find method (see the method’s description above).
► Use TestComplete’s image-search capabilities. You can call the Picture method of the web browser window to obtain a Picture object holding the window image, and then use the Find method of this object to search for the desired image. This method returns a rectangle that specifies coordinates of the image within the web browser window. To obtain the scripting object corresponding to the found image, you can use the Sys.ObjectFromPoint method. Both approaches are equally valid, however, finding the image by name works much faster. For more information and code examples, see the TestComplete Tips: Finding an Image on a Web Page blog on our AQCommunity site or the “Finding an Image on a Web Page” help topic.

Download XQuery Interview Questions And Answers PDF

Previous QuestionNext Question
Some elements on the web page I am testing contain leading (trailing) whitespaces. I am using the Utilities.Trim function to remove them, but sometimes it does not work. What is wrong?How can I check if a web page contains specific text?