WebDriverTargetLocator.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. * Used to locate a given frame or window.
  18. */
  19. interface WebDriverTargetLocator
  20. {
  21. /**
  22. * Switch to the main document if the page contains iframes. Otherwise, switch
  23. * to the first frame on the page.
  24. *
  25. * @return WebDriver The driver focused on the top window or the first frame.
  26. */
  27. public function defaultContent();
  28. /**
  29. * Switch to the iframe by its id or name.
  30. *
  31. * @param WebDriverElement|string $frame The WebDriverElement,
  32. * the id or the name of the frame.
  33. * @return WebDriver The driver focused on the given frame.
  34. */
  35. public function frame($frame);
  36. /**
  37. * Switch the focus to another window by its handle.
  38. *
  39. * @param string $handle The handle of the window to be focused on.
  40. * @return WebDriver Tge driver focused on the given window.
  41. * @see WebDriver::getWindowHandles
  42. */
  43. public function window($handle);
  44. /**
  45. * Switch to the currently active modal dialog for this particular driver
  46. * instance.
  47. *
  48. * @return WebDriverAlert
  49. */
  50. public function alert();
  51. /**
  52. * Switches to the element that currently has focus within the document
  53. * currently "switched to", or the body element if this cannot be detected.
  54. *
  55. * @return WebDriverElement
  56. */
  57. public function activeElement();
  58. }