@@ -126,26 +126,6 @@ public static function create(
126126 return $ driver ;
127127 }
128128
129- /**
130- * Cast legacy types (array or null) to DesiredCapabilities object. To be removed in future when instance of
131- * DesiredCapabilities will be required.
132- *
133- * @param array|DesiredCapabilities|null $desired_capabilities
134- * @return DesiredCapabilities
135- */
136- protected static function castToDesiredCapabilitiesObject ($ desired_capabilities = null )
137- {
138- if ($ desired_capabilities === null ) {
139- return new DesiredCapabilities ();
140- }
141-
142- if (is_array ($ desired_capabilities )) {
143- return new DesiredCapabilities ($ desired_capabilities );
144- }
145-
146- return $ desired_capabilities ;
147- }
148-
149129 /**
150130 * [Experimental] Construct the RemoteWebDriver by an existing session.
151131 *
@@ -293,29 +273,6 @@ public function quit()
293273 $ this ->executor = null ;
294274 }
295275
296- /**
297- * Prepare arguments for JavaScript injection
298- *
299- * @param array $arguments
300- * @return array
301- */
302- private function prepareScriptArguments (array $ arguments )
303- {
304- $ args = [];
305- foreach ($ arguments as $ key => $ value ) {
306- if ($ value instanceof WebDriverElement) {
307- $ args [$ key ] = ['ELEMENT ' => $ value ->getID ()];
308- } else {
309- if (is_array ($ value )) {
310- $ value = $ this ->prepareScriptArguments ($ value );
311- }
312- $ args [$ key ] = $ value ;
313- }
314- }
315-
316- return $ args ;
317- }
318-
319276 /**
320277 * Inject a snippet of JavaScript into the page for execution in the context
321278 * of the currently selected frame. The executed script is assumed to be
@@ -469,18 +426,6 @@ public function getTouch()
469426 return $ this ->touch ;
470427 }
471428
472- /**
473- * @return RemoteExecuteMethod
474- */
475- protected function getExecuteMethod ()
476- {
477- if (!$ this ->executeMethod ) {
478- $ this ->executeMethod = new RemoteExecuteMethod ($ this );
479- }
480-
481- return $ this ->executeMethod ;
482- }
483-
484429 /**
485430 * Construct a new action builder.
486431 *
@@ -491,17 +436,6 @@ public function action()
491436 return new WebDriverActions ($ this );
492437 }
493438
494- /**
495- * Return the WebDriverElement with the given id.
496- *
497- * @param string $id The id of the element to be created.
498- * @return RemoteWebElement
499- */
500- protected function newElement ($ id )
501- {
502- return new RemoteWebElement ($ this ->getExecuteMethod (), $ id );
503- }
504-
505439 /**
506440 * Set the command executor of this RemoteWebdriver
507441 *
@@ -601,4 +535,70 @@ public function execute($command_name, $params = [])
601535
602536 return null ;
603537 }
538+
539+ /**
540+ * Prepare arguments for JavaScript injection
541+ *
542+ * @param array $arguments
543+ * @return array
544+ */
545+ protected function prepareScriptArguments (array $ arguments )
546+ {
547+ $ args = [];
548+ foreach ($ arguments as $ key => $ value ) {
549+ if ($ value instanceof WebDriverElement) {
550+ $ args [$ key ] = ['ELEMENT ' => $ value ->getID ()];
551+ } else {
552+ if (is_array ($ value )) {
553+ $ value = $ this ->prepareScriptArguments ($ value );
554+ }
555+ $ args [$ key ] = $ value ;
556+ }
557+ }
558+
559+ return $ args ;
560+ }
561+
562+ /**
563+ * @return RemoteExecuteMethod
564+ */
565+ protected function getExecuteMethod ()
566+ {
567+ if (!$ this ->executeMethod ) {
568+ $ this ->executeMethod = new RemoteExecuteMethod ($ this );
569+ }
570+
571+ return $ this ->executeMethod ;
572+ }
573+
574+ /**
575+ * Return the WebDriverElement with the given id.
576+ *
577+ * @param string $id The id of the element to be created.
578+ * @return RemoteWebElement
579+ */
580+ protected function newElement ($ id )
581+ {
582+ return new RemoteWebElement ($ this ->getExecuteMethod (), $ id );
583+ }
584+
585+ /**
586+ * Cast legacy types (array or null) to DesiredCapabilities object. To be removed in future when instance of
587+ * DesiredCapabilities will be required.
588+ *
589+ * @param array|DesiredCapabilities|null $desired_capabilities
590+ * @return DesiredCapabilities
591+ */
592+ protected static function castToDesiredCapabilitiesObject ($ desired_capabilities = null )
593+ {
594+ if ($ desired_capabilities === null ) {
595+ return new DesiredCapabilities ();
596+ }
597+
598+ if (is_array ($ desired_capabilities )) {
599+ return new DesiredCapabilities ($ desired_capabilities );
600+ }
601+
602+ return $ desired_capabilities ;
603+ }
604604}
0 commit comments