如何点击PHP Selenium webdriver

时间:2017-10-23 14:09:22

标签: php selenium-webdriver

我有以下代码来检查复选框的可见性并单击复选框。我可以看到可见性代码成功运行但我无法单击该复选框。请告诉我如何使用PHP Selenium webdriver单击复选框?

<?php

use Facebook\WebDriver\WebDriverBy;
use Facebook\WebDriver\WebDriverSelect;

// wait until chekbox is visible
$driver->wait($wait)->until(
        IGAExpectedCondition::visibilityOfElementLocated(
            WebDriverBy::cssSelector('div.input-group input[type="checkbox"]')
        )
    , 'Checkbox not found or is not visible.');

$checkbox = $driver->findElement(WebDriverBy::cssSelector('div.input-group input[type="checkbox"]'));

if (!$checkbox->isSelected())
{
    $checkbox->click();
}
wait_for_jquery($driver);

$driver->findElement(WebDriverBy::name('save'))->click();

0 个答案:

没有答案