@@ -255,6 +255,7 @@ public void goToAssayResultImport(String assayName, boolean supportsTemplates)
255255 public String clickAndGetExampleData ()
256256 {
257257 Locator btn = Locator .linkContainingText ("Download Example Data" );
258+ String currentWindow = _test .getDriver ().getWindowHandle ();
258259 _test .waitForElement (btn );
259260 _test .waitAndClick (btn );
260261
@@ -270,25 +271,31 @@ public String clickAndGetExampleData()
270271 }
271272 }
272273
273- return getExampleData ();
274+ return getExampleData (currentWindow );
274275 }
275276
276277 public String getExampleData ()
278+ {
279+ return getExampleData (_test .getDriver ().getWindowHandle ());
280+ }
281+
282+ private String getExampleData (String currentWindow )
277283 {
278284 String ret = null ;
279285
280286 Set <String > handles = _test .getDriver ().getWindowHandles ();
281287 Assert .assertTrue ("Expected more than one open window, was: " + handles .size (), handles .size () > 1 );
282- String currentWindow = _test .getDriver ().getWindowHandle ();
283288 for (String handle : _test .getDriver ().getWindowHandles ())
284289 {
285290 if (!currentWindow .equals (handle ))
286291 {
287292 _test .getDriver ().switchTo ().window (handle );
288293 String text = getPageText ();
294+ ret = StringUtils .trimToNull (text );
295+ Assert .assertNotNull ("Unable to retrieve example data" , StringUtils .trimToNull (ret ));
296+
289297 _test .getDriver ().close ();
290298 _test .getDriver ().switchTo ().window (currentWindow );
291- ret = StringUtils .trimToNull (text );
292299 }
293300 }
294301
0 commit comments