Hi There,
Do we have any way to verification image load? Currently I need make sure the images are load successfully, the images can be changed, I just need make sure those images will be displayed, no 'X' there, but currently all images of the system are displayed, I have no way to record them, another question is can we use the same image for all other images?
Thanks
Waylon
Do we have any way to verification image load? Currently I need make sure the images are load successfully, the images can be changed, I just need make sure those images will be displayed, no 'X' there, but currently all images of the system are displayed, I have no way to record them, another question is can we use the same image for all other images?
Thanks
Waylon
4 Answers, 1 is accepted
0
Hello Waylon,
Please watch the episode on Telerik TV on Image Verification. This standard Image Verification will not work if the image changes, as it is based on image content. We have conceived a couple work-arounds, however:
For an advanced Image Comparison in code, please see this KB article.
Note: While you can manually build a verification of the image element based on "IsVisible," this step will pass even if an "X" loads instead of the actual image. In this case Test Studio is simply verifying the underlying element is visible, and not verifying that the element's image is properly loading.
Best wishes,
Anthony
the Telerik team
Please watch the episode on Telerik TV on Image Verification. This standard Image Verification will not work if the image changes, as it is based on image content. We have conceived a couple work-arounds, however:
- Perform an image verification on the red "X" when the image fails to load. Then, with the help of a coded step, you can tell the test to continue if the verification fails (which in this case means the real image loaded). If the verification passes (meaning the red "X" is showing and the image did not load), then the test fails.
- Craft a step entirely in code that sends a request to the image URL. If a 200 OK code is received, the step passes. If a 404 NOT FOUND code is received, the step fails.
For an advanced Image Comparison in code, please see this KB article.
Note: While you can manually build a verification of the image element based on "IsVisible," this step will pass even if an "X" loads instead of the actual image. In this case Test Studio is simply verifying the underlying element is visible, and not verifying that the element's image is properly loading.
Best wishes,
Anthony
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
0
Waylon
Top achievements
Rank 1
answered on 02 Jun 2011, 03:50 PM
Craft a step entirely in code that sends a request to the image URL. If a
200 OK code is received, the step passes. If a 404 NOT FOUND code is
received, the step fails.
How to send the request via Telerik?
How to send the request via Telerik?
0
Waylon
Top achievements
Rank 1
answered on 02 Jun 2011, 05:02 PM
I was coding this way, seems works
Private Function SendRequest(ByVal url As String)
Dim Request As HttpWebRequest = WebRequest.Create(url)
Dim Response As HttpWebResponse
Dim SW As StreamWriter
Dim SR As StreamReader
Dim ResponseData As String
Try
Response = Request.GetResponse()
SR = New StreamReader(Response.GetResponseStream())
ResponseData = SR.ReadToEnd()
Catch Wex As System.Net.WebException
SR = New StreamReader(Wex.Response.GetResponseStream())
ResponseData = SR.ReadToEnd()
Throw New Exception(ResponseData)
Finally
SR.Close()
End Try
Return ResponseData
End Function
Private Function SendRequest(ByVal url As String)
Dim Request As HttpWebRequest = WebRequest.Create(url)
Dim Response As HttpWebResponse
Dim SW As StreamWriter
Dim SR As StreamReader
Dim ResponseData As String
Try
Response = Request.GetResponse()
SR = New StreamReader(Response.GetResponseStream())
ResponseData = SR.ReadToEnd()
Catch Wex As System.Net.WebException
SR = New StreamReader(Wex.Response.GetResponseStream())
ResponseData = SR.ReadToEnd()
Throw New Exception(ResponseData)
Finally
SR.Close()
End Try
Return ResponseData
End Function
0
Hello Waylon,
I'm glad you got it working. Please contact us again if you have further questions.
Regards,
Anthony
the Telerik team
I'm glad you got it working. Please contact us again if you have further questions.
Regards,
Anthony
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>