|
13 | 13 |
|
14 | 14 | namespace Symfony\Component\Panther\ProcessManager;
|
15 | 15 |
|
| 16 | +use Facebook\WebDriver\Firefox\FirefoxOptions; |
16 | 17 | use Facebook\WebDriver\Remote\DesiredCapabilities;
|
17 | 18 | use Facebook\WebDriver\Remote\RemoteWebDriver;
|
18 | 19 | use Facebook\WebDriver\WebDriver;
|
@@ -52,20 +53,17 @@ public function start(): WebDriver
|
52 | 53 | $this->waitUntilReady($this->process, $url.$this->options['path'], 'firefox');
|
53 | 54 | }
|
54 | 55 |
|
55 |
| - $firefoxOptions = []; |
56 |
| - if (isset($_SERVER['PANTHER_FIREFOX_BINARY'])) { |
57 |
| - $firefoxOptions['binary'] = $_SERVER['PANTHER_FIREFOX_BINARY']; |
58 |
| - } |
59 |
| - if ($this->arguments) { |
60 |
| - $firefoxOptions['args'] = $this->arguments; |
61 |
| - } |
62 |
| - |
63 | 56 | $capabilities = DesiredCapabilities::firefox();
|
64 |
| - $capabilities->setCapability('moz:firefoxOptions', $firefoxOptions); |
65 | 57 |
|
66 | 58 | foreach ($this->options['capabilities'] as $capability => $value) {
|
67 | 59 | $capabilities->setCapability($capability, $value);
|
68 | 60 | }
|
| 61 | + $firefoxOptions = $capabilities->getCapability(FirefoxOptions::CAPABILITY); |
| 62 | + |
| 63 | + // if (isset($_SERVER['PANTHER_FIREFOX_BINARY'])) { |
| 64 | + // $firefoxOptions['binary'] = $_SERVER['PANTHER_FIREFOX_BINARY']; |
| 65 | + // } |
| 66 | + $firefoxOptions->addArguments($this->arguments); |
69 | 67 |
|
70 | 68 | return RemoteWebDriver::create($url, $capabilities, $this->options['connection_timeout_in_ms'] ?? null, $this->options['request_timeout_in_ms'] ?? null);
|
71 | 69 | }
|
@@ -113,12 +111,24 @@ private function getDefaultArguments(): array
|
113 | 111 |
|
114 | 112 | private function getDefaultOptions(): array
|
115 | 113 | {
|
| 114 | + $firefoxOptions = new FirefoxOptions(); |
| 115 | + |
| 116 | + // TODO: make this work - not sure why it doesn't :) |
| 117 | + $firefoxOptions->setPreference('devtools.netmonitor.enabled', true); |
| 118 | + $firefoxOptions->setPreference('devtools.netmonitor.har.enableAutoExportToFile', true); |
| 119 | + $firefoxOptions->setPreference('devtools.netmonitor.har.forceExport', true); |
| 120 | + $firefoxOptions->setPreference('devtools.netmonitor.har.defaultLogDir', '/tmp/panther-firefox/'); |
| 121 | + |
116 | 122 | return [
|
117 | 123 | 'scheme' => 'http',
|
118 | 124 | 'host' => '127.0.0.1',
|
119 | 125 | 'port' => 4444,
|
120 | 126 | 'path' => '/status',
|
121 | 127 | 'capabilities' => [],
|
| 128 | + 'capabilities' => [ |
| 129 | + 'acceptInsecureCerts' => true, |
| 130 | + FirefoxOptions::CAPABILITY => $firefoxOptions, |
| 131 | + ], |
122 | 132 | ];
|
123 | 133 | }
|
124 | 134 | }
|
0 commit comments