Source
$classes = [CMultifieldTableElement::class, CMultiselectElement::class, CCheckboxListElement::class, CHostInterfaceElement::class];
<?php
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
require_once 'vendor/autoload.php';
require_once dirname(__FILE__).'/../CElement.php';
use Facebook\WebDriver\Remote\RemoteWebElement;
/**
* Form element.
*/
class CFormElement extends CElement {
const TABLE_FORM = 'ul[contains(@class, "table-forms")]';
const TABLE_FORM_LEFT = 'div[contains(@class, "table-forms-td-left")]';
const TABLE_FORM_RIGHT = 'div[contains(@class, "table-forms-td-right")]';
/**
* Local form input cache.
* @var array
*/
protected $fields;
/**
* Condition to be filtered by.
* @var CElementFilter
*/
protected $filter = null;
/**
* @inheritdoc
*/
public static function createInstance(RemoteWebElement $element, $options = []) {
$instance = parent::createInstance($element, $options);
if (get_class($instance) !== CGridFormElement::class) {
$grid = $instance->query('xpath:.//div[contains(@class, "form-grid")]')->one(false);
if ($grid->isValid() && !$grid->parents('xpath:*[contains(@class, "table-forms-td-right")]')->exists()) {
return $instance->asGridForm($options);
}
}
return $instance;
}