a"; // Wait for error class to be set on input $this->elementWait($selector, self::CSS_SELECTOR); $aTag = $this->getRemoteWebElement($selector, self::CSS_SELECTOR); // Return if already selected if ($aTag->getAttribute('class') == $language) { return; } $this->scrollIntoViewHoverClick($selector, self::CSS_SELECTOR); $this->scrollIntoViewHoverClick("$selector + div li a#$language" , self::CSS_SELECTOR); $this->elementWait("$selector.$language", self::CSS_SELECTOR); $this->waitUntilDomReadyState(); } public function toggleCheckbox(string $chkSelector, bool $tick = true): void { $element = $this->getVisibleFormFieldElement($chkSelector, self::CSS_SELECTOR); $this->scrollElementIntoView($chkSelector, self::CSS_SELECTOR); $isChecked = str_contains($element->getAttribute('class'), "chked"); if ($isChecked !== $tick) { $element->click(); $this->waitUntilDomReadyState(); } } public function selectOptionByAttrDataOptionArrayIndex(string $id, $index): void { $select = "#$id > a > span"; $option = "#" . $id . ' > div li[data-option-array-index="' . $index . '"]'; $this->scrollIntoViewHoverClick($select, self::CSS_SELECTOR); $this->scrollIntoViewHoverClick($option, self::CSS_SELECTOR); } public function getElementInfo(RemoteWebElement $element): array { $tagName = $element->getTagName(); $classes = array_filter(explode(' ', $element->getAttribute('class') ?? '')); return [ 'tag' => $tagName, 'classes' => $classes, 'type' => $element->getAttribute('type'), // relevant for 'id' => $element->getAttribute('id'), 'name' => $element->getAttribute('name'), 'isSelect' => $tagName === 'select', 'isInput' => $tagName === 'input', 'isTextarea' => $tagName === 'textarea', 'isDatePicker'=> in_array('date-picker', $classes), 'isDropBox' => in_array('drop-box', $classes), 'isDisabled' => $element->getAttribute('disabled') !== null, ]; } public function selectCompMenuItem(object $page): void { $this->scrollIntoViewHoverClick("li.comp_profile > a", self::CSS_SELECTOR, false); $this->waitUntilDomReadyState(); $this->scrollIntoViewHoverClick($this->getCompMenuItemSelectXpathByTitle($page->menuItem), self::XPATH); } }