WebDriverSelectInterface.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. namespace Facebook\WebDriver;
  3. use Facebook\WebDriver\Exception\NoSuchElementException;
  4. use Facebook\WebDriver\Exception\UnsupportedOperationException;
  5. /**
  6. * Models an element of select type, providing helper methods to select and deselect options.
  7. */
  8. interface WebDriverSelectInterface
  9. {
  10. /**
  11. * @return bool Whether this select element support selecting multiple options.
  12. */
  13. public function isMultiple();
  14. /**
  15. * @return WebDriverElement[] All options belonging to this select tag.
  16. */
  17. public function getOptions();
  18. /**
  19. * @return WebDriverElement[] All selected options belonging to this select tag.
  20. */
  21. public function getAllSelectedOptions();
  22. /**
  23. * @throws NoSuchElementException
  24. *
  25. * @return WebDriverElement The first selected option in this select tag (or
  26. * the currently selected option in a normal select)
  27. */
  28. public function getFirstSelectedOption();
  29. /**
  30. * Select the option at the given index.
  31. *
  32. * @param int $index The index of the option. (0-based)
  33. *
  34. * @throws NoSuchElementException
  35. */
  36. public function selectByIndex($index);
  37. /**
  38. * Select all options that have value attribute matching the argument. That is, when given "foo" this would
  39. * select an option like:
  40. *
  41. * <option value="foo">Bar</option>;
  42. *
  43. * @param string $value The value to match against.
  44. *
  45. * @throws NoSuchElementException
  46. */
  47. public function selectByValue($value);
  48. /**
  49. * Select all options that display text matching the argument. That is, when given "Bar" this would
  50. * select an option like:
  51. *
  52. * <option value="foo">Bar</option>;
  53. *
  54. * @param string $text The visible text to match against.
  55. *
  56. * @throws NoSuchElementException
  57. */
  58. public function selectByVisibleText($text);
  59. /**
  60. * Select all options that display text partially matching the argument. That is, when given "Bar" this would
  61. * select an option like:
  62. *
  63. * <option value="bar">Foo Bar Baz</option>;
  64. *
  65. * @param string $text The visible text to match against.
  66. *
  67. * @throws NoSuchElementException
  68. */
  69. public function selectByVisiblePartialText($text);
  70. /**
  71. * Deselect all options in multiple select tag.
  72. *
  73. * @throws UnsupportedOperationException If the SELECT does not support multiple selections
  74. */
  75. public function deselectAll();
  76. /**
  77. * Deselect the option at the given index.
  78. *
  79. * @param int $index The index of the option. (0-based)
  80. * @throws UnsupportedOperationException If the SELECT does not support multiple selections
  81. */
  82. public function deselectByIndex($index);
  83. /**
  84. * Deselect all options that have value attribute matching the argument. That is, when given "foo" this would
  85. * deselect an option like:
  86. *
  87. * <option value="foo">Bar</option>;
  88. *
  89. * @param string $value The value to match against.
  90. * @throws UnsupportedOperationException If the SELECT does not support multiple selections
  91. */
  92. public function deselectByValue($value);
  93. /**
  94. * Deselect all options that display text matching the argument. That is, when given "Bar" this would
  95. * deselect an option like:
  96. *
  97. * <option value="foo">Bar</option>;
  98. *
  99. * @param string $text The visible text to match against.
  100. * @throws UnsupportedOperationException If the SELECT does not support multiple selections
  101. */
  102. public function deselectByVisibleText($text);
  103. /**
  104. * Deselect all options that display text matching the argument. That is, when given "Bar" this would
  105. * deselect an option like:
  106. *
  107. * <option value="foo">Foo Bar Baz</option>;
  108. *
  109. * @param string $text The visible text to match against.
  110. * @throws UnsupportedOperationException If the SELECT does not support multiple selections
  111. */
  112. public function deselectByVisiblePartialText($text);
  113. }