1<?php
2
3namespace Facebook\WebDriver;
4
5use Facebook\WebDriver\Remote\DriverCommand;
6use Facebook\WebDriver\Remote\ExecuteMethod;
7
8class WebDriverNavigation implements WebDriverNavigationInterface
9{
10    protected $executor;
11
12    public function __construct(ExecuteMethod $executor)
13    {
14        $this->executor = $executor;
15    }
16
17    public function back()
18    {
19        $this->executor->execute(DriverCommand::GO_BACK);
20
21        return $this;
22    }
23
24    public function forward()
25    {
26        $this->executor->execute(DriverCommand::GO_FORWARD);
27
28        return $this;
29    }
30
31    public function refresh()
32    {
33        $this->executor->execute(DriverCommand::REFRESH);
34
35        return $this;
36    }
37
38    public function to($url)
39    {
40        $params = ['url' => (string) $url];
41        $this->executor->execute(DriverCommand::GET, $params);
42
43        return $this;
44    }
45}
46