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)
156
156
}
157
157
158
158
/**
159
+ * @todo Remove side-effects - not change ie. ChromeOptions::CAPABILITY from instance of ChromeOptions to an array
159
160
* @return array
160
161
*/
161
162
public function toArray ()
Original file line number Diff line number Diff line change @@ -109,8 +109,10 @@ public static function create(
109
109
$ currentChromeOptions = $ desired_capabilities ->getCapability (ChromeOptions::CAPABILITY );
110
110
$ chromeOptions = !empty ($ currentChromeOptions ) ? $ currentChromeOptions : new ChromeOptions ();
111
111
112
- if (!isset ($ chromeOptions ->toArray ()['w3c ' ])) {
112
+ if ($ chromeOptions instanceof ChromeOptions && !isset ($ chromeOptions ->toArray ()['w3c ' ])) {
113
113
$ chromeOptions ->setExperimentalOption ('w3c ' , false );
114
+ } elseif (is_array ($ chromeOptions ) && !isset ($ chromeOptions ['w3c ' ])) {
115
+ $ chromeOptions ['w3c ' ] = false ;
114
116
}
115
117
116
118
$ desired_capabilities ->setCapability (ChromeOptions::CAPABILITY , $ chromeOptions );
Original file line number Diff line number Diff line change @@ -49,6 +49,19 @@ public function testShouldStartBrowserAndCreateInstanceOfRemoteWebDriver()
49
49
$ this ->assertSame ($ this ->desiredCapabilities ->getBrowserName (), $ returnedCapabilities ->getBrowserName ());
50
50
}
51
51
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
+
52
65
public function testShouldCreateWebDriverWithRequiredCapabilities ()
53
66
{
54
67
$ requiredCapabilities = new DesiredCapabilities ();
You can’t perform that action at this time.
0 commit comments