extending the protocol, easiest way to implement in java?

40 views
Skip to first unread message

Luke Inman-Semerau

unread,
Apr 9, 2013, 12:18:47 AM4/9/13
to selenium-...@googlegroups.com
There's been a bunch of talk surround extending the wire protocol for particular implementations, especially for mobile.

Well, I've got one that I'm trying to do in Selendroid. Namely an extension to an element itself.

What I'm doing exactly isn't the point of this thread (one can discuss that with me in another thread or in IRC if they want).

What I want to do is add a new method on an element, so I would have an endpoint like this:

/session/:sessionId/element/:id/-selendroid-my-method

First question, is that the intended way to extend the protocol?

Second question, the java classes don't seem to have an easy way to add my endpoint to the client bindings by extending certain classes. Like nameToUrl is a private map in HttpCommandExecutor. I don't like the idea of duplicating a bunch of code (or using reflection) because I can't easily extend certain classes or accessing key components to add my endpoint. Should these classes be made more 'extensible' to accomodate these extensions? or should I add my implementation specific endpoint to the client bindings? (obviously i don't think this is the case, hence this email)

-Luke

Adam Goucher

unread,
Apr 9, 2013, 7:32:46 AM4/9/13
to selenium-...@googlegroups.com
I've bumped into something similar to this with some of the PHPWebDriver
classes and I would guess that when you find something that would be
useful to be exposed for this sort of situation but isn't then you
should exploit your commit bit and make it visible.

'public class SelendroidCommandExecutor extends HttpCommandExecutor'
seems like a perfectly reasonable thing to try.

-adam
> Second question, the java classes don't seem to have an easy way to
> add my endpoint to the client bindings by extending certain classes.
> Like nameToUrl is a private map in HttpCommandExecutor. I don't like
> the idea of duplicating a bunch of code (or using reflection) because
> I can't easily extend certain classes or accessing key components to
> add my endpoint. Should these classes be made more 'extensible' to
> accomodate these extensions? or should I add my implementation
> specific endpoint to the client bindings? (obviously i don't think
> this is the case, hence this email)
>
> -Luke
> --
> You received this message because you are subscribed to the Google
> Groups "Selenium Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to selenium-develo...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Simon Stewart

unread,
Apr 19, 2013, 6:41:42 AM4/19/13
to selenium-developers
OK. So extending the protocol is covered here:


I'd suggest grouping all your extensions in the same URL space, so place "-selendroid" after the sessionId. 

Adding new commands is a doddle. You need to get hold of the http config (as you've already figured out) and that's easy enough to do:


Cheers,

Simon


--
Reply all
Reply to author
Forward
0 new messages