SilkTest Question 43: How to count the number of open browsers?

Let’s assume that interviewer for Software Quality Assurance Engineer position wants you to implement the function for counting number of browsers which he recently opened on his/her computer. No one knows the real need for such function, because average tester prefers to work just with one browser and as a part of test case preparation would close all remaining Internet Explorers or Firefoxes. The first question to ask is what type of browser do you want to check and after meaningful answer you can create something like following function written in 4test language which returns the required number for Internet Explorer.

integer GetBrowserCount ()
integer browsers = 1
while (MainWin ("$explorer6_DOM[{browsers}]").Exists ())
browsers ++
return (browsers -1)

No comments:

SilkTest interview questions for QA Testers