Completed
Pull Request — master (#189)
by Kevin
02:15
created

ByTextTrait   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getElement() 0 8 1
1
<?php
2
3
namespace Magium\Actions;
4
5
use Magium\WebDriver\WebDriver;
6
7
trait ByTextTrait
8
{
9
10
    /**
11
     * @param WebDriver $webDriver
12
     * @param $selector
13
     * @return \Facebook\WebDriver\Remote\RemoteWebElement|null
14
     */
15
16
    protected function getElement(WebDriver $webDriver, $selector)
17
    {
18
        $xpath = sprintf('//*[concat(" ", normalize-space(.), " ") = " %s "]', $selector);
19
20
        $element = $webDriver->byXpath($xpath);
21
        return $element;
22
23
    }
24
25
}
26