1717import org .openqa .selenium .TimeoutException ;
1818import org .openqa .selenium .WebDriver ;
1919import org .openqa .selenium .WebElement ;
20- import java .lang .reflect .InvocationTargetException ;
2120
2221/**
2322 * Encapsulates a model in Jenkins and wraps interactions with it.
@@ -47,7 +46,7 @@ public abstract class PageObject extends CapybaraPortingLayerImpl {
4746 private PageObject context ;
4847
4948 private static final RandomNameGenerator RND = new RandomNameGenerator ();
50-
49+
5150 /**
5251 * @deprecated Use {@link #PageObject(PageObject, URL)} instead to preserve per-test context.
5352 * Classes extending PageObject should pass the parent context to maintain proper test context.
@@ -57,7 +56,7 @@ public PageObject(Injector injector, URL url) {
5756 super (injector );
5857 this .url = url ;
5958 }
60-
59+
6160 /**
6261 * Creates a page object within an existing context (preserves the correct injector and metadata).
6362 */
@@ -69,7 +68,7 @@ protected PageObject(PageObject context, URL url) {
6968 /**
7069 * Helper constructor for migrating from injector-based initialization.
7170 * Creates a page object using Jenkins as context.
72- *
71+ *
7372 * @param injector The injector to use
7473 * @param url The URL of the page
7574 * @param jenkins The Jenkins instance to use as context
@@ -78,7 +77,7 @@ protected PageObject(Injector injector, URL url, Jenkins jenkins) {
7877 this (injector , url );
7978 this .context = jenkins ;
8079 }
81-
80+
8281 /**
8382 * Factory method to help migrate from injector-based initialization.
8483 * This should be used in place of direct constructor calls when a proper context is available.
@@ -95,6 +94,7 @@ public static <T extends PageObject> T create(Class<T> type, Injector injector,
9594 throw new RuntimeException ("Failed to create page object using context-based constructor" , e );
9695 }
9796 }
97+
9898 public static String createRandomName () {
9999 return RND .next ();
100100 }
0 commit comments