WebDriverElement.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. final class WebDriverElement extends WebDriverContainer {
  16. protected function methods() {
  17. return array(
  18. 'click' => 'POST',
  19. 'submit' => 'POST',
  20. 'text' => 'GET',
  21. 'value' => 'POST',
  22. 'name' => 'GET',
  23. 'clear' => 'POST',
  24. 'selected' => 'GET',
  25. 'enabled' => 'GET',
  26. 'attribute' => 'GET',
  27. 'equals' => 'GET',
  28. 'displayed' => 'GET',
  29. 'location' => 'GET',
  30. 'location_in_view' => 'GET',
  31. 'size' => 'GET',
  32. 'css' => 'GET',
  33. );
  34. }
  35. private $id;
  36. public function __construct($url, $id) {
  37. $this->id = $id;
  38. parent::__construct($url);
  39. }
  40. public function getID() {
  41. return $this->id;
  42. }
  43. protected function getElementPath($element_id) {
  44. return preg_replace(sprintf('/%s$/', $this->id), $element_id, $this->url);
  45. }
  46. }