F5 refresh emulation
I need your help on the below. We need to test a scenario where the user hits on the refresh button (F5) on the home page of the application continuously for 5 times(gap between each F5 hit should be less than 1 second) so that an error message is displayed.
Could you please let me know which function call or keyword can be used to emulate the above piece. Any possible ways to achieve will be helpful
RE: F5 refresh emulation
If you are using the Browser driven load testing approach within Silk Performer - Web Browser Driven (AJAX) - there is a named key available for the BrowserTypeKeys function which will allow you to simulate the F5 key on your keypad, which is generally the refresh key for a Browser. Copy the following syntax into a browser driven script to see refresh action taking place.
BrowserStart(BROWSER_MODE_DEFAULT, 960, 689);
wnd1 := BrowserGetActiveWindow("wnd1");
BrowserNavigate("http://demo.borland.com", "Navigate_http://demo.borland.com (#1)");
BrowserClick("//a[@textContents='Test Sites']", BUTTON_Left, "Click, A, textContents=Test Sites (#1)");
BrowserClick("//a[@textContents='ShopIt V 6.0']", BUTTON_Left, "Click, A, textContents=ShopIt V 6.0 (#1)");
BrowserClick("//a[@textContents='Join the experience!']", BUTTON_Left, "Click, A, textContents=Join the experience! (#1)");
BrowserTypeKeys("//body[@spellcheck='false']", "<F5>"); // Here the refresh will take place
BrowserClick("//input[@name='New-Name-Button']", BUTTON_Left, "Click, INPUT, name=New-Name-Button (#1)");
If I exclude the BrowserTypeKeys function from my script, what would occur is that TestUser string is entered into the text box and the user is then brought to the main page of the application (through the BrowserClick / New-Name button). Because I have included the BrowserTypeKeys which simulates the F5 key, after the data is entered, the browser is refreshed, thus data entered into the text box will disappear and navigation to the main page will not take place (as the system is expecting a name to be entered - which never was).
The key to successful implementation of this function is to ensure that you have a valid xpath locator string which can be used for the refresh simulation. Find a static element on the page you wish to carry out the refresh upon, i.e. an image or a piece of text. The xpath locator string can be retrieved through a browser driven recording and by interacting with the element, i.e. clicking - Silk Performer will record a function which contains the path. Within the subsequent script, include 5 BrowserTypeKeys("xpath", "<F5>"); functions within your script and insert the recorded xpath.
This should recreate the behaviour you require.
RE: F5 refresh emulation
Just adding to my previous response, there is also the BrowserReload function which you potentially use. Further information on both functions BrowserTypeKeys (including named keys) and BrowserReload can be found within the Silk Performer documentation - SILK PERFORMER | HELP | CONTENTS.