WebDriverElement.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <?php
  2. // Copyright 2004-present Facebook. All Rights Reserved.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. namespace Facebook\WebDriver;
  16. /**
  17. * Interface for an HTML element in the WebDriver framework.
  18. */
  19. interface WebDriverElement extends WebDriverSearchContext
  20. {
  21. /**
  22. * If this element is a TEXTAREA or text INPUT element, this will clear the value.
  23. *
  24. * @return WebDriverElement The current instance.
  25. */
  26. public function clear();
  27. /**
  28. * Click this element.
  29. *
  30. * @return WebDriverElement The current instance.
  31. */
  32. public function click();
  33. /**
  34. * Get the value of a the given attribute of the element.
  35. *
  36. * @param string $attribute_name The name of the attribute.
  37. * @return string The value of the attribute.
  38. */
  39. public function getAttribute($attribute_name);
  40. /**
  41. * Get the value of a given CSS property.
  42. *
  43. * @param string $css_property_name The name of the CSS property.
  44. * @return string The value of the CSS property.
  45. */
  46. public function getCSSValue($css_property_name);
  47. /**
  48. * Get the location of element relative to the top-left corner of the page.
  49. *
  50. * @return WebDriverPoint The location of the element.
  51. */
  52. public function getLocation();
  53. /**
  54. * Try scrolling the element into the view port and return the location of
  55. * element relative to the top-left corner of the page afterwards.
  56. *
  57. * @return WebDriverPoint The location of the element.
  58. */
  59. public function getLocationOnScreenOnceScrolledIntoView();
  60. /**
  61. * Get the size of element.
  62. *
  63. * @return WebDriverDimension The dimension of the element.
  64. */
  65. public function getSize();
  66. /**
  67. * Get the tag name of this element.
  68. *
  69. * @return string The tag name.
  70. */
  71. public function getTagName();
  72. /**
  73. * Get the visible (i.e. not hidden by CSS) innerText of this element,
  74. * including sub-elements, without any leading or trailing whitespace.
  75. *
  76. * @return string The visible innerText of this element.
  77. */
  78. public function getText();
  79. /**
  80. * Is this element displayed or not? This method avoids the problem of having
  81. * to parse an element's "style" attribute.
  82. *
  83. * @return bool
  84. */
  85. public function isDisplayed();
  86. /**
  87. * Is the element currently enabled or not? This will generally return true
  88. * for everything but disabled input elements.
  89. *
  90. * @return bool
  91. */
  92. public function isEnabled();
  93. /**
  94. * Determine whether or not this element is selected or not.
  95. *
  96. * @return bool
  97. */
  98. public function isSelected();
  99. /**
  100. * Simulate typing into an element, which may set its value.
  101. *
  102. * @param mixed $value The data to be typed.
  103. * @return WebDriverElement The current instance.
  104. */
  105. public function sendKeys($value);
  106. /**
  107. * If this current element is a form, or an element within a form, then this
  108. * will be submitted to the remote server.
  109. *
  110. * @return WebDriverElement The current instance.
  111. */
  112. public function submit();
  113. /**
  114. * Get the opaque ID of the element.
  115. *
  116. * @return string The opaque ID.
  117. */
  118. public function getID();
  119. }