TL;DR: I have a requirement for distributing business logic at runtime between a server and multiple remote clients running Selenium WebDriver .
I have looked at object serialization, RMI, downloading JARs on-the-fly, Selenese through Java and Selenium Grid.
Detail: Multiple remote clients are expected to poll a queue via JMS over the Internet to obtain an Order to go do some work on a given website. Each client will start Selenium WebDriver, traverse through that website in a manner that is not pre-defined (or only in very abstract terms) prior to client runtime, then go back to polling the queue until called again.
The challenge is that neither the website nor the exact traversing steps will be known to the client in advance. I can define the abstract steps / methods in advance on the server but the client will depend on some kind of downloaded data to obtain the list of Selenium commands precisely. There is also some looping required in those steps (repeat until...
).
For instance, if we define void login()
for example1.com:
- Click 'username' field
- Send keys 'username'
- Click 'password' field
- Send keys 'password'
- Click 'submit'
Whereas for example2.com void login()
would be:
- Click 'login' box
- Wait for 'username' field to appear
- Click 'username' field
- Click 'continue'
- etc.
Researched:
- Serialization: Will transfer only object variables, not object logic.
- RMI: Object logic is executed on the server, not the client, so it cannot interact with the client's Selenium instance.
- Downloading JARs on the fly: Possible solutions here and less optimistically here. Are these realistic?
- Selenese: Probably cannot be run directly under Java. Might be possible with selenese-runner-java but this appears to be command-line only, which would limit interaction with client software and therefore functionality
- Selenium Grid: Node (client) must be connected to Hub (server) at all times, which cannot be guaranteed
How can I distribute business logic from server to client at runtime in this way?