So I’m writing up a testbed using Selenium for our...
# announcements
t
So I’m writing up a testbed using Selenium for our web app. It’s a Single Page Application, so I wrote a function which makes initializing our Page Object Models easier, basically it just does a wait().until() with the predicate being some function defined in the POM that determines if its loaded. That’s real nice and all, but its still possible for someone unfamiliar with the code to do a PageFactory.init and run into problems because the page isn’t loaded due to the ajax requests not finishing. What I’d really like to do is define a wrapper type like
UnintializedPage<T> where T: IPage
and use my loading function as a way to extract the type
T
, with the goal of making it impossible to retrieve a page without initializing it. I think this is kinda similar to the elvis operator converting String? to String, but instead of proving something isn’t null, it proves some html has loaded in selenium. I think it would be like changing the logic of the
?:
operator to check if a page model is loaded, and timeout if it isn’t. Probably more complicated than it needs to be, but would be neat to enforce this requirement using the type system.