1: <?php
2: namespace Azalea\Selenium\EHR\UI;
3:
4: class Grid extends \Azalea\Selenium\Core\View
5: {
6: protected static $selector = "";
7: protected static $searchSelector = "";
8:
9: 10: 11: 12: 13:
14: public function getRowbyIndex($index)
15: {
16: return $this->byCss($this->getCssByIndex($index));
17: }
18:
19: 20: 21: 22: 23:
24: public function getCssByIndex($index)
25: {
26: $css = $this->getSelector() . ' [data-grid-row="'.$index.'"]';
27: $this->byCss($css);
28: return $css;
29: }
30:
31: 32: 33: 34: 35:
36: public function hasRow($index)
37: {
38: try {
39: $this->getRowByIndex($index);
40: return true;
41: } catch(\Exception $e) {
42: return false;
43: }
44: }
45:
46: 47: 48: 49: 50: 51:
52: public function setSearchText($text)
53: {
54: if(static::$searchSelector) {
55: $element = $this->byCss($this->getSelector() . ' ' . static::$searchSelector);
56: $element->clear();
57: $element->value($text);
58: } else {
59: throw new \Exception("Attempting to set search text BUT searchSelector not set.");
60: }
61: }
62:
63: 64: 65: 66:
67: public function verify($args = array())
68: {
69: $this->byCss($this->getSelector($args));
70: return true;
71: }
72: }
73: