1<?php
2
3namespace Facebook\WebDriver;
4
5use Facebook\WebDriver\Exception\WebDriverException;
6
7/**
8 * Provides helper methods for checkboxes.
9 */
10class WebDriverCheckboxes extends AbstractWebDriverCheckboxOrRadio
11{
12    public function __construct(WebDriverElement $element)
13    {
14        parent::__construct($element);
15
16        $this->type = $element->getAttribute('type');
17        if ($this->type !== 'checkbox') {
18            throw new WebDriverException('The input must be of type "checkbox".');
19        }
20    }
21
22    public function isMultiple()
23    {
24        return true;
25    }
26
27    public function deselectAll()
28    {
29        foreach ($this->getRelatedElements() as $checkbox) {
30            $this->deselectOption($checkbox);
31        }
32    }
33
34    public function deselectByIndex($index)
35    {
36        $this->byIndex($index, false);
37    }
38
39    public function deselectByValue($value)
40    {
41        $this->byValue($value, false);
42    }
43
44    public function deselectByVisibleText($text)
45    {
46        $this->byVisibleText($text, false, false);
47    }
48
49    public function deselectByVisiblePartialText($text)
50    {
51        $this->byVisibleText($text, true, false);
52    }
53}
54