1 | <?php |
||
11 | trait PageContentTrait { |
||
12 | |||
13 | /** |
||
14 | * @return string |
||
15 | */ |
||
16 | public function getContent() { |
||
25 | |||
26 | /** |
||
27 | * Given xpath, will try to get ALL the text, visible and not visible from such xpath |
||
28 | * @param string $xpath |
||
29 | * @return string |
||
30 | * @throws DriverException |
||
31 | */ |
||
32 | public function getText($xpath) { |
||
40 | |||
41 | /** |
||
42 | * Returns the inner html of a given xpath |
||
43 | * @param string $xpath |
||
44 | * @return string |
||
45 | * @throws DriverException |
||
46 | */ |
||
47 | public function getHtml($xpath) { |
||
52 | |||
53 | /** |
||
54 | * Gets the outer html of a given xpath |
||
55 | * @param string $xpath |
||
56 | * @return string |
||
57 | * @throws DriverException |
||
58 | */ |
||
59 | public function getOuterHtml($xpath) { |
||
64 | |||
65 | /** |
||
66 | * Returns the binary representation of the current page we are in |
||
67 | * @throws DriverException |
||
68 | * @return string |
||
69 | */ |
||
70 | public function getScreenshot() { |
||
78 | } |
||
79 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: