qfs.qft
qfs.qft
'Name of the browser window' Example
In order to distinguish between browser windows QF-Test requires additional information.
This information specifies which window should be used for replaying events.
The attribute 'Name of the browser window' has to be set in both 'Wait for document to load' and the recorded 'Web page'.
In the 'Web page' Component set it to {default:windowname:}.
Important: do not forget to set the variable 'windowname' before replying the required test actions.
import java.io.BufferedWriter
import java.io.FileWriter
def String createHtmlFileWithContent(String filePath, String content){
FileWriter fWriter = null;
BufferedWriter writer = null;
try {
fWriter = new FileWriter(filePath);
writer = new BufferedWriter(fWriter);
writer.write(content);
writer.newLine();
writer.close();
} catch (Exception e) {
//catch any exceptions here
}
}
String dirFiles = rc.lookup("qftest","suite.dir")+File.separatorChar;
String pathMainHtml = dirFiles+"browserWindows.html";
String contentMainHtml = "<!doctype html>\r\n<html>\r\n <head>\r\n <meta http-equiv=\"Content-type\" content=\"text/html;charset=ISO-8859-1\">\r\n <title>Address multiple browser windows</title>\r\n <script> \r\n function popup(url)\r\n {\r\n window.open(url, \"MyPopup\", \"width=320, height=400, directories=no, location=no, resizable=no, menubar=no\");\r\n }\r\n </script>\r\n </head>\r\n <body>\r\n <p>\r\n <a href=\"javascript:popup('browserWindows.html')\">Popup</a><br>\r\n </p> \r\n </body>\r\n</html>\r\n"
String pathPopupHtml = dirFiles+"popup.html";
String contentPopupHtml = "<html>\r\n<head>\r\n <meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\">\r\n <title>Address multiple browser windows</title>\r\n</head>\r\n<body>\r\n <p>\r\n Hello from the popup.\r\n </p>\r\n <br>\r\n <button type=\"button\" onclick=\"window.close()\">Close</button>\r\n </p>\r\n</body>\r\n</html>"
createHtmlFileWithContent(pathMainHtml, contentMainHtml)
createHtmlFileWithContent(pathPopupHtml, contentPopupHtml)
browserWindows
chrome
This node checks whether the SUT is already running. The result of this check will be stored in the variable isSUTRunning. The variable itself can contain true if SUT is already running or false if SUT is not running. This variable will be used in the following 'If' node.
$(client)
$(browser)
$(browserdir)
true
true
true
en
false
false
no
$(client)
autodetect
DIV,SPAN,
1
3
2
1
1
1
1
2
2
3
3
1
2
1
This call installs a CustomWebResolver for AJAX toolkits.
The CustomWebResolver concept allows you to map the specific attributes of your web application to QF-Test generic classes. This will cause QF-Test to trigger default mechanisms of its component recognition and checking behavior.
Your testing will become more stable, robust and readable using this approach.
The most important parameter is 'genericClasses'. You can take a value from the 'class' attribute of a component of your web page like 'btn' and turn it into a QF-Test button via writing btn=Button. You can add more definitions separated via comma.
You can find more information at the 'Procedure' node itself, simply perform a double clickon that call to jump there.
In the manual you can find a full example.
second
Here you can see that the window closing is sent to the correct window
Now go to the "browserWindows" Component. There you will see the use of the variable.
browserWindows.html
DOCUMENT
Window
DOCUMENT
Address multiple browser windows
HTML
HTML
HTML
BODY
BODY
BODY
P
P
P