This repository was archived by the owner on Mar 4, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,7 @@ public function setJavascriptEnabled($enabled)
156156 }
157157
158158 /**
159+ * @todo Remove side-effects - not change ie. ChromeOptions::CAPABILITY from instance of ChromeOptions to an array
159160 * @return array
160161 */
161162 public function toArray ()
Original file line number Diff line number Diff line change @@ -109,8 +109,10 @@ public static function create(
109109 $ currentChromeOptions = $ desired_capabilities ->getCapability (ChromeOptions::CAPABILITY );
110110 $ chromeOptions = !empty ($ currentChromeOptions ) ? $ currentChromeOptions : new ChromeOptions ();
111111
112- if (!isset ($ chromeOptions ->toArray ()['w3c ' ])) {
112+ if ($ chromeOptions instanceof ChromeOptions && !isset ($ chromeOptions ->toArray ()['w3c ' ])) {
113113 $ chromeOptions ->setExperimentalOption ('w3c ' , false );
114+ } elseif (is_array ($ chromeOptions ) && !isset ($ chromeOptions ['w3c ' ])) {
115+ $ chromeOptions ['w3c ' ] = false ;
114116 }
115117
116118 $ desired_capabilities ->setCapability (ChromeOptions::CAPABILITY , $ chromeOptions );
Original file line number Diff line number Diff line change @@ -49,6 +49,19 @@ public function testShouldStartBrowserAndCreateInstanceOfRemoteWebDriver()
4949 $ this ->assertSame ($ this ->desiredCapabilities ->getBrowserName (), $ returnedCapabilities ->getBrowserName ());
5050 }
5151
52+ public function testShouldAcceprCapabilitiesAsAnArray ()
53+ {
54+ // Method has a side-effect of converting whole content of desiredCapabilities to an array
55+ $ this ->desiredCapabilities ->toArray ();
56+
57+ $ this ->driver = RemoteWebDriver::create (
58+ $ this ->serverUrl ,
59+ $ this ->desiredCapabilities ,
60+ $ this ->connectionTimeout ,
61+ $ this ->requestTimeout
62+ );
63+ }
64+
5265 public function testShouldCreateWebDriverWithRequiredCapabilities ()
5366 {
5467 $ requiredCapabilities = new DesiredCapabilities ();
You can’t perform that action at this time.
0 commit comments