3 namespace Zumba\GastonJS\Browser;
5 use Zumba\GastonJS\NetworkTraffic\Request;
8 * Trait BrowserNetworkTrait
9 * @package Zumba\GastonJS\Browser
11 trait BrowserNetworkTrait {
13 * Get all the network traffic that the page have created
16 public function networkTraffic() {
17 $networkTraffic = $this->command('network_traffic');
18 $requestTraffic = array();
20 if (count($networkTraffic) === 0) {
24 foreach ($networkTraffic as $traffic) {
25 $requestTraffic[] = new Request($traffic["request"], $traffic["responseParts"]);
28 return $requestTraffic;
32 * Clear the network traffic data stored on the phantomjs code
35 public function clearNetworkTraffic() {
36 return $this->command('clear_network_traffic');