Closed Bug 845805 Opened 7 years ago Closed 7 years ago

Add a By class to the marionette python bindings

Categories

(Testing :: Marionette, enhancement)

enhancement
Not set

Tracking

(Not tracked)

RESOLVED FIXED
mozilla25

People

(Reporter: Bebe, Assigned: Bebe)

Details

(Whiteboard: [good first bug][mentor=automatedtester][lang=py])

Attachments

(1 file, 3 obsolete files)

It would be nice to have access to a By class similar to the one found in the Selenium Python bindings.

Selenium class:
http://selenium.googlecode.com/svn/trunk/docs/api/py/_modules/selenium/webdriver/common/by.html#By

This class will abstract all the selector types and will help us write locators in a more elegant and easy way.
Whiteboard: [good first bug][mentor=automatedtester][lang=py]
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.
Assignee: nobody → florin.strugariu
Attached patch Patch v1.0 (obsolete) — Splinter Review
I added the requested class
Attachment #718997 - Flags: review?(dburns)
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.
:bebe

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
> https://hg.mozilla.org/integration/mozilla-inbound/file/9a8d04f67e39/testing/
> marionette/client/marionette/test_protocol.py#l46

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
Attached patch Parch version 1.1 (obsolete) — Splinter Review
I updated the license and modified the tests
Attachment #718997 - Attachment is obsolete: true
Attachment #718997 - Flags: review?(dburns)
Attachment #721133 - Flags: review?
Attachment #721133 - Flags: review? → review?(dburns)
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.
Attachment #721133 - Flags: review?(dburns) → review-
Attachment #721133 - Attachment is obsolete: true
Attachment #771285 - Flags: review?(dburns)
Attachment #771289 - Flags: review?(dburns) → review+
https://hg.mozilla.org/mozilla-central/rev/a75301db9899
Status: NEW → RESOLVED
Closed: 7 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.