@@ -142,6 +142,19 @@ var buildElementHelper = function(ptor) {
142
142
} ;
143
143
util . inherits ( ElementArrayFinder , webdriver . promise . Promise ) ;
144
144
145
+ /**
146
+ * Create a shallow copy of ElementArrayFinder.
147
+ *
148
+ * @return {!ElementArrayFinder } A shallow copy of this.
149
+ */
150
+ ElementArrayFinder . prototype . clone = function ( ) {
151
+ // A shallow copy is all we need since the underlying fields can never be
152
+ // modified. (Locator can be modified by the user, but that should
153
+ // rarely/never happen and it doesn't affect functionalities).
154
+ return new ElementArrayFinder (
155
+ this . getWebElements , this . locator_ , this . actionResults_ ) ;
156
+ } ;
157
+
145
158
/**
146
159
* Calls to ElementArrayFinder may be chained to find an array of elements
147
160
* using the current elements in this ElementArrayFinder as the starting point.
@@ -722,6 +735,17 @@ var buildElementHelper = function(ptor) {
722
735
} ;
723
736
util . inherits ( ElementFinder , webdriver . promise . Promise ) ;
724
737
738
+ /**
739
+ * Create a shallow copy of ElementFinder.
740
+ *
741
+ * @return {!ElementFinder } A shallow copy of this.
742
+ */
743
+ ElementFinder . prototype . clone = function ( ) {
744
+ // A shallow copy is all we need since the underlying fields can never be
745
+ // modified
746
+ return new ElementFinder ( this . parentElementArrayFinder ) ;
747
+ } ;
748
+
725
749
/**
726
750
* See ElementArrayFinder.prototype.locator
727
751
* @return {webdriver.Locator }
0 commit comments