It would be nice to have access to a By class similar to the one found in the Selenium Python bindings.
This class will abstract all the selector types and will help us write locators in a more elegant and easy way.
If we add a class to http://mxr.mozilla.org/mozilla-central/source/testing/marionette/client/marionette/ then we should be able to do this. The class just removes the potential issue with people putting their own strings in.
Created attachment 718997 [details] [diff] [review]
I added the requested class
This looks ok, can you update some of the tests so I can push this to try for you and see if it works when being referenced from other files
I don't think we can take a copyrighted file, reproduce it exactly, but change the license header to ours. If we want this file, we should just copy it exactly (including license notices) from upstream.
Agreed with Jonathan terms 3 of Apache License for Distribution.
"You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works"
Sorry for this mistake guys I will update my patch.
I took a better look at the binding sand I found https://hg.mozilla.org/integration/mozilla-inbound/file/9a8d04f67e39/testing/marionette/client/marionette/marionette.py#l21
What I'm asking is implemented in the HTMLElement and used in https://hg.mozilla.org/integration/mozilla-inbound/file/9a8d04f67e39/testing/marionette/client/marionette/test_protocol.py#l46
I think this is a bad implementation because you would get access to all the methods in that class witch are not usable.
Please create the file, according to feed back above.
(In reply to Florin Strugariu [:Bebe] from comment #7)
> What I'm asking is implemented in the HTMLElement and used in
I think a better implementation is with a By too since HTMLElement.ID is ambiguous. Is it the mechanism to find or is it the elements ID. Please copy the Selenium file, licence and all, and update some tests so that we know that the egg is packaging them properly
Created attachment 721133 [details] [diff] [review]
Parch version 1.1
I updated the license and modified the tests
Comment on attachment 721133 [details] [diff] [review]
Parch version 1.1
> class By(object):
> ID = "id"
> XPATH = "xpath"
> LINK_TEXT = "link text"
> PARTIAL_LINK_TEXT = "partial link text"
> NAME = "name"
Please can we add the values and not just the top five. Also can you please update a few other test files, 2 files of your choosing.
Created attachment 771285 [details] [diff] [review]
patch for Bug 845805 - Add a By class to the marionette python bindings
Created attachment 771289 [details] [diff] [review]
Bug 845805 - Add a By class to the marionette python bindings
pushed to try
landed in https://hg.mozilla.org/integration/mozilla-inbound/rev/a75301db9899