Version 1
[yaffs-website] / vendor / jcalderonzumba / gastonjs / src / Browser / BrowserNavigateTrait.php
1 <?php
2
3 namespace Zumba\GastonJS\Browser;
4
5 use Zumba\GastonJS\Exception\BrowserError;
6
7 /**
8  * Trait BrowserNavigateTrait
9  * @package Zumba\GastonJS\Browser
10  */
11 trait BrowserNavigateTrait {
12
13   /**
14    * Send a visit command to the browser
15    * @param $url
16    * @return mixed
17    */
18   public function visit($url) {
19     return $this->command('visit', $url);
20   }
21
22   /**
23    * Gets the current url we are in
24    * @return mixed
25    */
26   public function currentUrl() {
27     return $this->command('current_url');
28   }
29
30   /**
31    * Goes back on the browser history if possible
32    * @return bool
33    * @throws BrowserError
34    * @throws \Exception
35    */
36   public function goBack() {
37     return $this->command('go_back');
38   }
39
40   /**
41    * Goes forward on the browser history if possible
42    * @return mixed
43    * @throws BrowserError
44    * @throws \Exception
45    */
46   public function goForward() {
47     return $this->command('go_forward');
48   }
49
50   /**
51    * Reloads the current page we are in
52    */
53   public function reload() {
54     return $this->command('reload');
55   }
56 }