本文整理汇总了PHP中SeleniumClient\By::cssSelector方法的典型用法代码示例。如果您正苦于以下问题:PHP By::cssSelector方法的具体用法?PHP By::cssSelector怎么用?PHP By::cssSelector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SeleniumClient\By
的用法示例。
在下文中一共展示了By::cssSelector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDemo1
public function testDemo1()
{
//get url
$this->_driver->get($this->_testUrl);
//access text input
$webElement = $this->_driver->findElement(By::id("txt1"));
$webElement->clear();
$webElement->sendKeys("Text sent 1");
$this->assertEquals("Text sent 1", $webElement->getAttribute("value"));
$webElement = $this->_driver->findElement(By::id("txt2"));
$webElement->clear();
$webElement->sendKeys("Text sent 2");
$this->assertEquals("Text sent 2", $webElement->getAttribute("value"));
//access listbox
$selectElement = new SelectElement($this->_driver->findElement(By::id("sel1")));
$selectElement->selectByValue("4");
$this->assertTrue($selectElement->getElement()->findElement(By::xPath(".//option[@value = 4]"))->isSelected());
//access checkbox
$webElement = $this->_driver->findElement(By::cssSelector("html body table tbody tr td fieldset form p input#chk3"));
$webElement->click();
$this->assertTrue($webElement->isSelected());
//access radio
$webElement = $this->_driver->findElement(By::id("rd3"));
$webElement->click();
$this->assertTrue($webElement->isSelected());
//access button
$webElement = $this->_driver->findElement(By::id("btnSubmit"));
$webElement->click();
//access h2
$webElement = $this->_driver->findElement(By::cssSelector("html body h2#h2FormReceptor"));
$this->assertEquals("Form receptor", $webElement->getText());
sleep(20);
}