WebDriverElementProxy::getAttribute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Magium\WebDriver;
4
5
use Facebook\WebDriver\WebDriverBy;
6
use Facebook\WebDriver\WebDriverElement;
7
8
class WebDriverElementProxy implements WebDriverElement
9
{
10
11
    protected $webDriver;
12
    protected $selector;
13
    protected $by;
14
    protected $element;
15
16
    public function __construct(
17
        WebDriver $webDriver,
18
        $selector,
19
        $by = WebDriver::BY_ID
20
    )
21
    {
22
        $this->webDriver = $webDriver;
23
        $this->selector = $selector;
24
        $this->by = $by;
25
    }
26
27
    public function __call($name, $arguments)
28
    {
29
        if (strpos($name, '::') > 0) {
30
            list(   , $name) = explode('::', $name);
31
        }
32
        if (!$this->element instanceof WebDriverElement) {
33
            $this->element = $this->webDriver->{$this->by}($this->selector);
34
        }
35
        $return = call_user_func_array([$this->element, $name], $arguments);
36
        return $return;
37
    }
38
39
    public function clear()
40
    {
41
        return $this->__call(__METHOD__, func_get_args());
42
    }
43
44
    public function click()
45
    {
46
        return $this->__call(__METHOD__, func_get_args());
47
    }
48
49
    public function getAttribute($attribute_name)
50
    {
51
        return $this->__call(__METHOD__, func_get_args());
52
    }
53
54
    public function getCSSValue($css_property_name)
55
    {
56
        return $this->__call(__METHOD__, func_get_args());
57
    }
58
59
    public function getLocation()
60
    {
61
        return $this->__call(__METHOD__, func_get_args());
62
    }
63
64
    public function getLocationOnScreenOnceScrolledIntoView()
65
    {
66
        return $this->__call(__METHOD__, func_get_args());
67
    }
68
69
    public function getSize()
70
    {
71
        return $this->__call(__METHOD__, func_get_args());
72
    }
73
74
    public function getTagName()
75
    {
76
        return $this->__call(__METHOD__, func_get_args());
77
    }
78
79
    public function getText()
80
    {
81
        return $this->__call(__METHOD__, func_get_args());
82
    }
83
84
    public function isDisplayed()
85
    {
86
        return $this->__call(__METHOD__, func_get_args());
87
    }
88
89
    public function isEnabled()
90
    {
91
        return $this->__call(__METHOD__, func_get_args());
92
    }
93
94
    public function isSelected()
95
    {
96
        return $this->__call(__METHOD__, func_get_args());
97
    }
98
99
    public function sendKeys($value)
100
    {
101
        return $this->__call(__METHOD__, func_get_args());
102
    }
103
104
    public function submit()
105
    {
106
        return $this->__call(__METHOD__, func_get_args());
107
    }
108
109
    public function getID()
110
    {
111
        return $this->__call(__METHOD__, func_get_args());
112
    }
113
114
    public function findElement(WebDriverBy $locator)
115
    {
116
        return $this->__call(__METHOD__, func_get_args());
117
    }
118
119
    public function findElements(WebDriverBy $locator)
120
    {
121
        return $this->__call(__METHOD__, func_get_args());
122
    }
123
124
125
}