PageRenderTime 72ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/blog/www/system/library/PEAR/Testing/Selenium.php

https://bitbucket.org/vmihailenco/vladimirwebdev
PHP | 2506 lines | 627 code | 280 blank | 1599 comment | 6 complexity | 5f292cc61bdf59fa5f88bdf8ec7bd186 MD5 | raw file
Possible License(s): BSD-3-Clause

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /** Copyright 2006 ThoughtWorks, Inc
  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. *
  16. * -----------------
  17. * This file has been automatically generated via XSL
  18. * -----------------
  19. *
  20. *
  21. *
  22. * @category Testing
  23. * @package Selenium
  24. * @author Shin Ohno <ganchiku at gmail dot com>
  25. * @author Bjoern Schotte <schotte at mayflower dot de>
  26. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  27. * @version @package_version@
  28. * @see http://www.openqa.org/selenium-rc/
  29. * @since 0.1
  30. */
  31. /**
  32. * Selenium exception class
  33. */
  34. require_once 'Testing/Selenium/Exception.php';
  35. /**
  36. * Defines an object that runs Selenium commands.
  37. *
  38. *
  39. * <p>
  40. * <b>Element Locators</b>
  41. * </p><p>
  42. *
  43. * Element Locators tell Selenium which HTML element a command refers to.
  44. * The format of a locator is:
  45. * </p><p>
  46. *
  47. * <i>locatorType</i><b>=</b><i>argument</i>
  48. * </p>
  49. * <p>
  50. *
  51. * We support the following strategies for locating elements:
  52. *
  53. * </p>
  54. * <ul>
  55. *
  56. * <li>
  57. * <b>identifier</b>=<i>id</i>:
  58. * Select the element with the specified @id attribute. If no match is
  59. * found, select the first element whose @name attribute is <i>id</i>.
  60. * (This is normally the default; see below.)
  61. * </li>
  62. * <li>
  63. * <b>id</b>=<i>id</i>:
  64. * Select the element with the specified @id attribute.
  65. * </li>
  66. * <li>
  67. * <b>name</b>=<i>name</i>:
  68. * Select the first element with the specified @name attribute.
  69. *
  70. * <ul>
  71. *
  72. * <li>
  73. * username
  74. * </li>
  75. * <li>
  76. * name=username
  77. * </li>
  78. * </ul>
  79. <p>
  80. * The name may optionally be followed by one or more <i>element-filters</i>, separated from the name by whitespace. If the <i>filterType</i> is not specified, <b>value</b> is assumed.
  81. * </p>
  82. * <ul>
  83. *
  84. * <li>
  85. * name=flavour value=chocolate
  86. * </li>
  87. * </ul>
  88. * </li>
  89. * <li>
  90. * <b>dom</b>=<i>javascriptExpression</i>:
  91. *
  92. * Find an element by evaluating the specified string. This allows you to traverse the HTML Document Object
  93. * Model using JavaScript. Note that you must not return a value in this string; simply make it the last expression in the block.
  94. *
  95. * <ul>
  96. *
  97. * <li>
  98. * dom=document.forms['myForm'].myDropdown
  99. * </li>
  100. * <li>
  101. * dom=document.images[56]
  102. * </li>
  103. * <li>
  104. * dom=function foo() { return document.links[1]; }; foo();
  105. * </li>
  106. * </ul>
  107. * </li>
  108. * <li>
  109. * <b>xpath</b>=<i>xpathExpression</i>:
  110. * Locate an element using an XPath expression.
  111. *
  112. * <ul>
  113. *
  114. * <li>
  115. * xpath=//img[@alt='The image alt text']
  116. * </li>
  117. * <li>
  118. * xpath=//table[@id='table1']//tr[4]/td[2]
  119. * </li>
  120. * <li>
  121. * xpath=//a[contains(@href,'#id1')]
  122. * </li>
  123. * <li>
  124. * xpath=//a[contains(@href,'#id1')]/@class
  125. * </li>
  126. * <li>
  127. * xpath=(//table[@class='stylee'])//th[text()='theHeaderText']/../td
  128. * </li>
  129. * <li>
  130. * xpath=//input[@name='name2' and @value='yes']
  131. * </li>
  132. * <li>
  133. * xpath=//*[text()="right"]
  134. * </li>
  135. * </ul>
  136. * </li>
  137. * <li>
  138. * <b>link</b>=<i>textPattern</i>:
  139. * Select the link (anchor) element which contains text matching the
  140. * specified <i>pattern</i>.
  141. *
  142. * <ul>
  143. *
  144. * <li>
  145. * link=The link text
  146. * </li>
  147. * </ul>
  148. * </li>
  149. * <li>
  150. * <b>css</b>=<i>cssSelectorSyntax</i>:
  151. * Select the element using css selectors. Please refer to CSS2 selectors, CSS3 selectors for more information. You can also check the TestCssLocators test in the selenium test suite for an example of usage, which is included in the downloaded selenium core package.
  152. *
  153. * <ul>
  154. *
  155. * <li>
  156. * css=a[href="#id3"]
  157. * </li>
  158. * <li>
  159. * css=span#firstChild + span
  160. * </li>
  161. * </ul>
  162. <p>
  163. * Currently the css selector locator supports all css1, css2 and css3 selectors except namespace in css3, some pseudo classes(:nth-of-type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type, :visited, :hover, :active, :focus, :indeterminate) and pseudo elements(::first-line, ::first-letter, ::selection, ::before, ::after).
  164. * </p>
  165. * </li>
  166. * </ul><p>
  167. *
  168. * Without an explicit locator prefix, Selenium uses the following default
  169. * strategies:
  170. *
  171. * </p>
  172. * <ul>
  173. *
  174. * <li>
  175. * <b>dom</b>, for locators starting with "document."
  176. * </li>
  177. * <li>
  178. * <b>xpath</b>, for locators starting with "//"
  179. * </li>
  180. * <li>
  181. * <b>identifier</b>, otherwise
  182. * </li>
  183. * </ul>
  184. * <p>
  185. * <b>Element Filters</b>
  186. * </p><p>
  187. *
  188. * <p>
  189. * Element filters can be used with a locator to refine a list of candidate elements. They are currently used only in the 'name' element-locator.
  190. * </p>
  191. <p>
  192. * Filters look much like locators, ie.
  193. * </p>
  194. <p>
  195. *
  196. * <i>filterType</i><b>=</b><i>argument</i>
  197. * </p>
  198. * <p>
  199. * Supported element-filters are:
  200. * </p>
  201. <p>
  202. * <b>value=</b><i>valuePattern</i>
  203. * </p>
  204. <p>
  205. *
  206. *
  207. * Matches elements based on their values. This is particularly useful for refining a list of similarly-named toggle-buttons.
  208. * </p>
  209. * <p>
  210. * <b>index=</b><i>index</i>
  211. * </p>
  212. <p>
  213. *
  214. *
  215. * Selects a single element based on its position in the list (offset from zero).
  216. * </p>
  217. *
  218. * </p>
  219. *
  220. * <p>
  221. * <b>String-match Patterns</b>
  222. * </p><p>
  223. *
  224. * Various Pattern syntaxes are available for matching string values:
  225. *
  226. * </p>
  227. * <ul>
  228. *
  229. * <li>
  230. * <b>glob:</b><i>pattern</i>:
  231. * Match a string against a "glob" (aka "wildmat") pattern. "Glob" is a
  232. * kind of limited regular-expression syntax typically used in command-line
  233. * shells. In a glob pattern, "*" represents any sequence of characters, and "?"
  234. * represents any single character. Glob patterns match against the entire
  235. * string.
  236. * </li>
  237. * <li>
  238. * <b>regexp:</b><i>regexp</i>:
  239. * Match a string using a regular-expression. The full power of JavaScript
  240. * regular-expressions is available.
  241. * </li>
  242. * <li>
  243. * <b>regexpi:</b><i>regexpi</i>:
  244. * Match a string using a case-insensitive regular-expression.
  245. * </li>
  246. * <li>
  247. * <b>exact:</b><i>string</i>:
  248. *
  249. * Match a string exactly, verbatim, without any of that fancy wildcard
  250. * stuff.
  251. * </li>
  252. * </ul><p>
  253. *
  254. * If no pattern prefix is specified, Selenium assumes that it's a "glob"
  255. * pattern.
  256. *
  257. * </p><p>
  258. *
  259. * For commands that return multiple values (such as verifySelectOptions),
  260. * the string being matched is a comma-separated list of the return values,
  261. * where both commas and backslashes in the values are backslash-escaped.
  262. * When providing a pattern, the optional matching syntax (i.e. glob,
  263. * regexp, etc.) is specified once, as usual, at the beginning of the
  264. * pattern.
  265. *
  266. * </p>
  267. *
  268. * @package Selenium
  269. * @author Shin Ohno <ganchiku at gmail dot com>
  270. * @author Bjoern Schotte <schotte at mayflower dot de>
  271. */
  272. class Testing_Selenium
  273. {
  274. /**
  275. * @var string
  276. * @access private
  277. */
  278. private $browser;
  279. /**
  280. * @var string
  281. * @access private
  282. */
  283. private $browserUrl;
  284. /**
  285. * @var string
  286. * @access private
  287. */
  288. private $host;
  289. /**
  290. * @var int
  291. * @access private
  292. */
  293. private $port;
  294. /**
  295. * @var string
  296. * @access private
  297. */
  298. private $sessionId;
  299. /**
  300. * @var string
  301. * @access private
  302. */
  303. private $timeout;
  304. /**
  305. * Constructor
  306. *
  307. * @param string $browser
  308. * @param string $browserUrl
  309. * @param string $host
  310. * @param int $port
  311. * @param int $timeout
  312. * @access public
  313. * @throws Testing_Selenium_Exception
  314. */
  315. public function __construct($browser, $browserUrl, $host = 'localhost', $port = 4444, $timeout = 30000)
  316. {
  317. $this->browser = $browser;
  318. $this->browserUrl = $browserUrl;
  319. $this->host = $host;
  320. $this->port = $port;
  321. $this->timeout = $timeout;
  322. }
  323. /**
  324. * Run the browser and set session id.
  325. *
  326. * @access public
  327. * @return void
  328. */
  329. public function start()
  330. {
  331. $this->sessionId = $this->getString("getNewBrowserSession", array($this->browser, $this->browserUrl));
  332. return $this->sessionId;
  333. }
  334. /**
  335. * Close the browser and set session id null
  336. *
  337. * @access public
  338. * @return void
  339. */
  340. public function stop()
  341. {
  342. $this->doCommand("testComplete");
  343. $this->sessionId = null;
  344. }
  345. /**
  346. * Clicks on a link, button, checkbox or radio button. If the click action
  347. * causes a new page to load (like a link usually does), call
  348. * waitForPageToLoad.
  349. *
  350. * @access public
  351. * @param string $locator an element locator
  352. */
  353. public function click($locator)
  354. {
  355. $this->doCommand("click", array($locator));
  356. }
  357. /**
  358. * Double clicks on a link, button, checkbox or radio button. If the double click action
  359. * causes a new page to load (like a link usually does), call
  360. * waitForPageToLoad.
  361. *
  362. * @access public
  363. * @param string $locator an element locator
  364. */
  365. public function doubleClick($locator)
  366. {
  367. $this->doCommand("doubleClick", array($locator));
  368. }
  369. /**
  370. * Simulates opening the context menu for the specified element (as might happen if the user "right-clicked" on the element).
  371. *
  372. * @access public
  373. * @param string $locator an element locator
  374. */
  375. public function contextMenu($locator)
  376. {
  377. $this->doCommand("contextMenu", array($locator));
  378. }
  379. /**
  380. * Clicks on a link, button, checkbox or radio button. If the click action
  381. * causes a new page to load (like a link usually does), call
  382. * waitForPageToLoad.
  383. *
  384. * @access public
  385. * @param string $locator an element locator
  386. * @param string $coordString specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
  387. */
  388. public function clickAt($locator, $coordString)
  389. {
  390. $this->doCommand("clickAt", array($locator, $coordString));
  391. }
  392. /**
  393. * Doubleclicks on a link, button, checkbox or radio button. If the action
  394. * causes a new page to load (like a link usually does), call
  395. * waitForPageToLoad.
  396. *
  397. * @access public
  398. * @param string $locator an element locator
  399. * @param string $coordString specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
  400. */
  401. public function doubleClickAt($locator, $coordString)
  402. {
  403. $this->doCommand("doubleClickAt", array($locator, $coordString));
  404. }
  405. /**
  406. * Simulates opening the context menu for the specified element (as might happen if the user "right-clicked" on the element).
  407. *
  408. * @access public
  409. * @param string $locator an element locator
  410. * @param string $coordString specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
  411. */
  412. public function contextMenuAt($locator, $coordString)
  413. {
  414. $this->doCommand("contextMenuAt", array($locator, $coordString));
  415. }
  416. /**
  417. * Explicitly simulate an event, to trigger the corresponding "on<i>event</i>"
  418. * handler.
  419. *
  420. * @access public
  421. * @param string $locator an element locator
  422. * @param string $eventName the event name, e.g. "focus" or "blur"
  423. */
  424. public function fireEvent($locator, $eventName)
  425. {
  426. $this->doCommand("fireEvent", array($locator, $eventName));
  427. }
  428. /**
  429. * Move the focus to the specified element; for example, if the element is an input field, move the cursor to that field.
  430. *
  431. * @access public
  432. * @param string $locator an element locator
  433. */
  434. public function focus($locator)
  435. {
  436. $this->doCommand("focus", array($locator));
  437. }
  438. /**
  439. * Simulates a user pressing and releasing a key.
  440. *
  441. * @access public
  442. * @param string $locator an element locator
  443. * @param string $keySequence Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".
  444. */
  445. public function keyPress($locator, $keySequence)
  446. {
  447. $this->doCommand("keyPress", array($locator, $keySequence));
  448. }
  449. /**
  450. * Press the shift key and hold it down until doShiftUp() is called or a new page is loaded.
  451. *
  452. * @access public
  453. */
  454. public function shiftKeyDown()
  455. {
  456. $this->doCommand("shiftKeyDown", array());
  457. }
  458. /**
  459. * Release the shift key.
  460. *
  461. * @access public
  462. */
  463. public function shiftKeyUp()
  464. {
  465. $this->doCommand("shiftKeyUp", array());
  466. }
  467. /**
  468. * Press the meta key and hold it down until doMetaUp() is called or a new page is loaded.
  469. *
  470. * @access public
  471. */
  472. public function metaKeyDown()
  473. {
  474. $this->doCommand("metaKeyDown", array());
  475. }
  476. /**
  477. * Release the meta key.
  478. *
  479. * @access public
  480. */
  481. public function metaKeyUp()
  482. {
  483. $this->doCommand("metaKeyUp", array());
  484. }
  485. /**
  486. * Press the alt key and hold it down until doAltUp() is called or a new page is loaded.
  487. *
  488. * @access public
  489. */
  490. public function altKeyDown()
  491. {
  492. $this->doCommand("altKeyDown", array());
  493. }
  494. /**
  495. * Release the alt key.
  496. *
  497. * @access public
  498. */
  499. public function altKeyUp()
  500. {
  501. $this->doCommand("altKeyUp", array());
  502. }
  503. /**
  504. * Press the control key and hold it down until doControlUp() is called or a new page is loaded.
  505. *
  506. * @access public
  507. */
  508. public function controlKeyDown()
  509. {
  510. $this->doCommand("controlKeyDown", array());
  511. }
  512. /**
  513. * Release the control key.
  514. *
  515. * @access public
  516. */
  517. public function controlKeyUp()
  518. {
  519. $this->doCommand("controlKeyUp", array());
  520. }
  521. /**
  522. * Simulates a user pressing a key (without releasing it yet).
  523. *
  524. * @access public
  525. * @param string $locator an element locator
  526. * @param string $keySequence Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".
  527. */
  528. public function keyDown($locator, $keySequence)
  529. {
  530. $this->doCommand("keyDown", array($locator, $keySequence));
  531. }
  532. /**
  533. * Simulates a user releasing a key.
  534. *
  535. * @access public
  536. * @param string $locator an element locator
  537. * @param string $keySequence Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".
  538. */
  539. public function keyUp($locator, $keySequence)
  540. {
  541. $this->doCommand("keyUp", array($locator, $keySequence));
  542. }
  543. /**
  544. * Simulates a user hovering a mouse over the specified element.
  545. *
  546. * @access public
  547. * @param string $locator an element locator
  548. */
  549. public function mouseOver($locator)
  550. {
  551. $this->doCommand("mouseOver", array($locator));
  552. }
  553. /**
  554. * Simulates a user moving the mouse pointer away from the specified element.
  555. *
  556. * @access public
  557. * @param string $locator an element locator
  558. */
  559. public function mouseOut($locator)
  560. {
  561. $this->doCommand("mouseOut", array($locator));
  562. }
  563. /**
  564. * Simulates a user pressing the mouse button (without releasing it yet) on
  565. * the specified element.
  566. *
  567. * @access public
  568. * @param string $locator an element locator
  569. */
  570. public function mouseDown($locator)
  571. {
  572. $this->doCommand("mouseDown", array($locator));
  573. }
  574. /**
  575. * Simulates a user pressing the mouse button (without releasing it yet) at
  576. * the specified location.
  577. *
  578. * @access public
  579. * @param string $locator an element locator
  580. * @param string $coordString specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
  581. */
  582. public function mouseDownAt($locator, $coordString)
  583. {
  584. $this->doCommand("mouseDownAt", array($locator, $coordString));
  585. }
  586. /**
  587. * Simulates the event that occurs when the user releases the mouse button (i.e., stops
  588. * holding the button down) on the specified element.
  589. *
  590. * @access public
  591. * @param string $locator an element locator
  592. */
  593. public function mouseUp($locator)
  594. {
  595. $this->doCommand("mouseUp", array($locator));
  596. }
  597. /**
  598. * Simulates the event that occurs when the user releases the mouse button (i.e., stops
  599. * holding the button down) at the specified location.
  600. *
  601. * @access public
  602. * @param string $locator an element locator
  603. * @param string $coordString specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
  604. */
  605. public function mouseUpAt($locator, $coordString)
  606. {
  607. $this->doCommand("mouseUpAt", array($locator, $coordString));
  608. }
  609. /**
  610. * Simulates a user pressing the mouse button (without releasing it yet) on
  611. * the specified element.
  612. *
  613. * @access public
  614. * @param string $locator an element locator
  615. */
  616. public function mouseMove($locator)
  617. {
  618. $this->doCommand("mouseMove", array($locator));
  619. }
  620. /**
  621. * Simulates a user pressing the mouse button (without releasing it yet) on
  622. * the specified element.
  623. *
  624. * @access public
  625. * @param string $locator an element locator
  626. * @param string $coordString specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
  627. */
  628. public function mouseMoveAt($locator, $coordString)
  629. {
  630. $this->doCommand("mouseMoveAt", array($locator, $coordString));
  631. }
  632. /**
  633. * Sets the value of an input field, as though you typed it in.
  634. *
  635. * <p>
  636. * Can also be used to set the value of combo boxes, check boxes, etc. In these cases,
  637. * value should be the value of the option selected, not the visible text.
  638. * </p>
  639. *
  640. * @access public
  641. * @param string $locator an element locator
  642. * @param string $value the value to type
  643. */
  644. public function type($locator, $value)
  645. {
  646. $this->doCommand("type", array($locator, $value));
  647. }
  648. /**
  649. * Simulates keystroke events on the specified element, as though you typed the value key-by-key.
  650. *
  651. * <p>
  652. * This is a convenience method for calling keyDown, keyUp, keyPress for every character in the specified string;
  653. * this is useful for dynamic UI widgets (like auto-completing combo boxes) that require explicit key events.
  654. * </p><p>
  655. * Unlike the simple "type" command, which forces the specified value into the page directly, this command
  656. * may or may not have any visible effect, even in cases where typing keys would normally have a visible effect.
  657. * For example, if you use "typeKeys" on a form element, you may or may not see the results of what you typed in
  658. * the field.
  659. * </p><p>
  660. * In some cases, you may need to use the simple "type" command to set the value of the field and then the "typeKeys" command to
  661. * send the keystroke events corresponding to what you just typed.
  662. * </p>
  663. *
  664. * @access public
  665. * @param string $locator an element locator
  666. * @param string $value the value to type
  667. */
  668. public function typeKeys($locator, $value)
  669. {
  670. $this->doCommand("typeKeys", array($locator, $value));
  671. }
  672. /**
  673. * Set execution speed (i.e., set the millisecond length of a delay which will follow each selenium operation). By default, there is no such delay, i.e.,
  674. * the delay is 0 milliseconds.
  675. *
  676. * @access public
  677. * @param string $value the number of milliseconds to pause after operation
  678. */
  679. public function setSpeed($value)
  680. {
  681. $this->doCommand("setSpeed", array($value));
  682. }
  683. /**
  684. * Get execution speed (i.e., get the millisecond length of the delay following each selenium operation). By default, there is no such delay, i.e.,
  685. * the delay is 0 milliseconds.
  686. *
  687. * See also setSpeed.
  688. *
  689. * @access public
  690. * @return string the execution speed in milliseconds.
  691. */
  692. public function getSpeed()
  693. {
  694. return $this->getString("getSpeed", array());
  695. }
  696. /**
  697. * Check a toggle-button (checkbox/radio)
  698. *
  699. * @access public
  700. * @param string $locator an element locator
  701. */
  702. public function check($locator)
  703. {
  704. $this->doCommand("check", array($locator));
  705. }
  706. /**
  707. * Uncheck a toggle-button (checkbox/radio)
  708. *
  709. * @access public
  710. * @param string $locator an element locator
  711. */
  712. public function uncheck($locator)
  713. {
  714. $this->doCommand("uncheck", array($locator));
  715. }
  716. /**
  717. * Select an option from a drop-down using an option locator.
  718. *
  719. * <p>
  720. *
  721. * Option locators provide different ways of specifying options of an HTML
  722. * Select element (e.g. for selecting a specific option, or for asserting
  723. * that the selected option satisfies a specification). There are several
  724. * forms of Select Option Locator.
  725. *
  726. * </p>
  727. * <ul>
  728. *
  729. * <li>
  730. * <b>label</b>=<i>labelPattern</i>:
  731. * matches options based on their labels, i.e. the visible text. (This
  732. * is the default.)
  733. *
  734. * <ul>
  735. *
  736. * <li>
  737. * label=regexp:^[Oo]ther
  738. * </li>
  739. * </ul>
  740. * </li>
  741. * <li>
  742. * <b>value</b>=<i>valuePattern</i>:
  743. * matches options based on their values.
  744. *
  745. * <ul>
  746. *
  747. * <li>
  748. * value=other
  749. * </li>
  750. * </ul>
  751. * </li>
  752. * <li>
  753. * <b>id</b>=<i>id</i>:
  754. *
  755. * matches options based on their ids.
  756. *
  757. * <ul>
  758. *
  759. * <li>
  760. * id=option1
  761. * </li>
  762. * </ul>
  763. * </li>
  764. * <li>
  765. * <b>index</b>=<i>index</i>:
  766. * matches an option based on its index (offset from zero).
  767. *
  768. * <ul>
  769. *
  770. * <li>
  771. * index=2
  772. * </li>
  773. * </ul>
  774. * </li>
  775. * </ul><p>
  776. *
  777. * If no option locator prefix is provided, the default behaviour is to match on <b>label</b>.
  778. *
  779. * </p>
  780. *
  781. * @access public
  782. * @param string $selectLocator an element locator identifying a drop-down menu
  783. * @param string $optionLocator an option locator (a label by default)
  784. */
  785. public function select($selectLocator, $optionLocator)
  786. {
  787. $this->doCommand("select", array($selectLocator, $optionLocator));
  788. }
  789. /**
  790. * Add a selection to the set of selected options in a multi-select element using an option locator.
  791. *
  792. * @see #doSelect for details of option locators
  793. *
  794. * @access public
  795. * @param string $locator an element locator identifying a multi-select box
  796. * @param string $optionLocator an option locator (a label by default)
  797. */
  798. public function addSelection($locator, $optionLocator)
  799. {
  800. $this->doCommand("addSelection", array($locator, $optionLocator));
  801. }
  802. /**
  803. * Remove a selection from the set of selected options in a multi-select element using an option locator.
  804. *
  805. * @see #doSelect for details of option locators
  806. *
  807. * @access public
  808. * @param string $locator an element locator identifying a multi-select box
  809. * @param string $optionLocator an option locator (a label by default)
  810. */
  811. public function removeSelection($locator, $optionLocator)
  812. {
  813. $this->doCommand("removeSelection", array($locator, $optionLocator));
  814. }
  815. /**
  816. * Unselects all of the selected options in a multi-select element.
  817. *
  818. * @access public
  819. * @param string $locator an element locator identifying a multi-select box
  820. */
  821. public function removeAllSelections($locator)
  822. {
  823. $this->doCommand("removeAllSelections", array($locator));
  824. }
  825. /**
  826. * Submit the specified form. This is particularly useful for forms without
  827. * submit buttons, e.g. single-input "Search" forms.
  828. *
  829. * @access public
  830. * @param string $formLocator an element locator for the form you want to submit
  831. */
  832. public function submit($formLocator)
  833. {
  834. $this->doCommand("submit", array($formLocator));
  835. }
  836. /**
  837. * Opens an URL in the test frame. This accepts both relative and absolute
  838. * URLs.
  839. *
  840. * The "open" command waits for the page to load before proceeding,
  841. * ie. the "AndWait" suffix is implicit.
  842. *
  843. * <i>Note</i>: The URL must be on the same domain as the runner HTML
  844. * due to security restrictions in the browser (Same Origin Policy). If you
  845. * need to open an URL on another domain, use the Selenium Server to start a
  846. * new browser session on that domain.
  847. *
  848. * @access public
  849. * @param string $url the URL to open; may be relative or absolute
  850. */
  851. public function open($url)
  852. {
  853. $this->doCommand("open", array($url));
  854. }
  855. /**
  856. * Opens a popup window (if a window with that ID isn't already open).
  857. * After opening the window, you'll need to select it using the selectWindow
  858. * command.
  859. *
  860. * <p>
  861. * This command can also be a useful workaround for bug SEL-339. In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
  862. * In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
  863. * an empty (blank) url, like this: openWindow("", "myFunnyWindow").
  864. * </p>
  865. *
  866. * @access public
  867. * @param string $url the URL to open, which can be blank
  868. * @param string $windowID the JavaScript window ID of the window to select
  869. */
  870. public function openWindow($url, $windowID)
  871. {
  872. $this->doCommand("openWindow", array($url, $windowID));
  873. }
  874. /**
  875. * Selects a popup window using a window locator; once a popup window has been selected, all
  876. * commands go to that window. To select the main window again, use null
  877. * as the target.
  878. *
  879. * <p>
  880. *
  881. *
  882. * Window locators provide different ways of specifying the window object:
  883. * by title, by internal JavaScript "name," or by JavaScript variable.
  884. *
  885. * </p>
  886. * <ul>
  887. *
  888. * <li>
  889. * <b>title</b>=<i>My Special Window</i>:
  890. * Finds the window using the text that appears in the title bar. Be careful;
  891. * two windows can share the same title. If that happens, this locator will
  892. * just pick one.
  893. *
  894. * </li>
  895. * <li>
  896. * <b>name</b>=<i>myWindow</i>:
  897. * Finds the window using its internal JavaScript "name" property. This is the second
  898. * parameter "windowName" passed to the JavaScript method window.open(url, windowName, windowFeatures, replaceFlag)
  899. * (which Selenium intercepts).
  900. *
  901. * </li>
  902. * <li>
  903. * <b>var</b>=<i>variableName</i>:
  904. * Some pop-up windows are unnamed (anonymous), but are associated with a JavaScript variable name in the current
  905. * application window, e.g. "window.foo = window.open(url);". In those cases, you can open the window using
  906. * "var=foo".
  907. *
  908. * </li>
  909. * </ul><p>
  910. *
  911. * If no window locator prefix is provided, we'll try to guess what you mean like this:
  912. * </p><p>
  913. * 1.) if windowID is null, (or the string "null") then it is assumed the user is referring to the original window instantiated by the browser).
  914. * </p><p>
  915. * 2.) if the value of the "windowID" parameter is a JavaScript variable name in the current application window, then it is assumed
  916. * that this variable contains the return value from a call to the JavaScript window.open() method.
  917. * </p><p>
  918. * 3.) Otherwise, selenium looks in a hash it maintains that maps string names to window "names".
  919. * </p><p>
  920. * 4.) If <i>that</i> fails, we'll try looping over all of the known windows to try to find the appropriate "title".
  921. * Since "title" is not necessarily unique, this may have unexpected behavior.
  922. * </p><p>
  923. * If you're having trouble figuring out the name of a window that you want to manipulate, look at the Selenium log messages
  924. * which identify the names of windows created via window.open (and therefore intercepted by Selenium). You will see messages
  925. * like the following for each window as it is opened:
  926. * </p><p>
  927. * <code>debug: window.open call intercepted; window ID (which you can use with selectWindow()) is "myNewWindow"</code>
  928. * </p><p>
  929. * In some cases, Selenium will be unable to intercept a call to window.open (if the call occurs during or before the "onLoad" event, for example).
  930. * (This is bug SEL-339.) In those cases, you can force Selenium to notice the open window's name by using the Selenium openWindow command, using
  931. * an empty (blank) url, like this: openWindow("", "myFunnyWindow").
  932. * </p>
  933. *
  934. * @access public
  935. * @param string $windowID the JavaScript window ID of the window to select
  936. */
  937. public function selectWindow($windowID)
  938. {
  939. $this->doCommand("selectWindow", array($windowID));
  940. }
  941. /**
  942. * Selects a frame within the current window. (You may invoke this command
  943. * multiple times to select nested frames.) To select the parent frame, use
  944. * "relative=parent" as a locator; to select the top frame, use "relative=top".
  945. * You can also select a frame by its 0-based index number; select the first frame with
  946. * "index=0", or the third frame with "index=2".
  947. *
  948. * <p>
  949. * You may also use a DOM expression to identify the frame you want directly,
  950. * like this: <code>dom=frames["main"].frames["subframe"]</code>
  951. * </p>
  952. *
  953. * @access public
  954. * @param string $locator an element locator identifying a frame or iframe
  955. */
  956. public function selectFrame($locator)
  957. {
  958. $this->doCommand("selectFrame", array($locator));
  959. }
  960. /**
  961. * Determine whether current/locator identify the frame containing this running code.
  962. *
  963. * <p>
  964. * This is useful in proxy injection mode, where this code runs in every
  965. * browser frame and window, and sometimes the selenium server needs to identify
  966. * the "current" frame. In this case, when the test calls selectFrame, this
  967. * routine is called for each frame to figure out which one has been selected.
  968. * The selected frame will return true, while all others will return false.
  969. * </p>
  970. *
  971. * @access public
  972. * @param string $currentFrameString starting frame
  973. * @param string $target new frame (which might be relative to the current one)
  974. * @return boolean true if the new frame is this code's window
  975. */
  976. public function getWhetherThisFrameMatchFrameExpression($currentFrameString, $target)
  977. {
  978. return $this->getBoolean("getWhetherThisFrameMatchFrameExpression", array($currentFrameString, $target));
  979. }
  980. /**
  981. * Determine whether currentWindowString plus target identify the window containing this running code.
  982. *
  983. * <p>
  984. * This is useful in proxy injection mode, where this code runs in every
  985. * browser frame and window, and sometimes the selenium server needs to identify
  986. * the "current" window. In this case, when the test calls selectWindow, this
  987. * routine is called for each window to figure out which one has been selected.
  988. * The selected window will return true, while all others will return false.
  989. * </p>
  990. *
  991. * @access public
  992. * @param string $currentWindowString starting window
  993. * @param string $target new window (which might be relative to the current one, e.g., "_parent")
  994. * @return boolean true if the new window is this code's window
  995. */
  996. public function getWhetherThisWindowMatchWindowExpression($currentWindowString, $target)
  997. {
  998. return $this->getBoolean("getWhetherThisWindowMatchWindowExpression", array($currentWindowString, $target));
  999. }
  1000. /**
  1001. * Waits for a popup window to appear and load up.
  1002. *
  1003. * @access public
  1004. * @param string $windowID the JavaScript window "name" of the window that will appear (not the text of the title bar)
  1005. * @param string $timeout a timeout in milliseconds, after which the action will return with an error
  1006. */
  1007. public function waitForPopUp($windowID, $timeout)
  1008. {
  1009. $this->doCommand("waitForPopUp", array($windowID, $timeout));
  1010. }
  1011. /**
  1012. * By default, Selenium's overridden window.confirm() function will
  1013. * return true, as if the user had manually clicked OK; after running
  1014. * this command, the next call to confirm() will return false, as if
  1015. * the user had clicked Cancel. Selenium will then resume using the
  1016. * default behavior for future confirmations, automatically returning
  1017. * true (OK) unless/until you explicitly call this command for each
  1018. * confirmation.
  1019. *
  1020. * @access public
  1021. */
  1022. public function chooseCancelOnNextConfirmation()
  1023. {
  1024. $this->doCommand("chooseCancelOnNextConfirmation", array());
  1025. }
  1026. /**
  1027. * Undo the effect of calling chooseCancelOnNextConfirmation. Note
  1028. * that Selenium's overridden window.confirm() function will normally automatically
  1029. * return true, as if the user had manually clicked OK, so you shouldn't
  1030. * need to use this command unless for some reason you need to change
  1031. * your mind prior to the next confirmation. After any confirmation, Selenium will resume using the
  1032. * default behavior for future confirmations, automatically returning
  1033. * true (OK) unless/until you explicitly call chooseCancelOnNextConfirmation for each
  1034. * confirmation.
  1035. *
  1036. * @access public
  1037. */
  1038. public function chooseOkOnNextConfirmation()
  1039. {
  1040. $this->doCommand("chooseOkOnNextConfirmation", array());
  1041. }
  1042. /**
  1043. * Instructs Selenium to return the specified answer string in response to
  1044. * the next JavaScript prompt [window.prompt()].
  1045. *
  1046. * @access public
  1047. * @param string $answer the answer to give in response to the prompt pop-up
  1048. */
  1049. public function answerOnNextPrompt($answer)
  1050. {
  1051. $this->doCommand("answerOnNextPrompt", array($answer));
  1052. }
  1053. /**
  1054. * Simulates the user clicking the "back" button on their browser.
  1055. *
  1056. * @access public
  1057. */
  1058. public function goBack()
  1059. {
  1060. $this->doCommand("goBack", array());
  1061. }
  1062. /**
  1063. * Simulates the user clicking the "Refresh" button on their browser.
  1064. *
  1065. * @access public
  1066. */
  1067. public function refresh()
  1068. {
  1069. $this->doCommand("refresh", array());
  1070. }
  1071. /**
  1072. * Simulates the user clicking the "close" button in the titlebar of a popup
  1073. * window or tab.
  1074. *
  1075. * @access public
  1076. */
  1077. public function close()
  1078. {
  1079. $this->doCommand("close", array());
  1080. }
  1081. /**
  1082. * Has an alert occurred?
  1083. *
  1084. * <p>
  1085. *
  1086. * This function never throws an exception
  1087. *
  1088. * </p>
  1089. *
  1090. * @access public
  1091. * @return boolean true if there is an alert
  1092. */
  1093. public function isAlertPresent()
  1094. {
  1095. return $this->getBoolean("isAlertPresent", array());
  1096. }
  1097. /**
  1098. * Has a prompt occurred?
  1099. *
  1100. * <p>
  1101. *
  1102. * This function never throws an exception
  1103. *
  1104. * </p>
  1105. *
  1106. * @access public
  1107. * @return boolean true if there is a pending prompt
  1108. */
  1109. public function isPromptPresent()
  1110. {
  1111. return $this->getBoolean("isPromptPresent", array());
  1112. }
  1113. /**
  1114. * Has confirm() been called?
  1115. *
  1116. * <p>
  1117. *
  1118. * This function never throws an exception
  1119. *
  1120. * </p>
  1121. *
  1122. * @access public
  1123. * @return boolean true if there is a pending confirmation
  1124. */
  1125. public function isConfirmationPresent()
  1126. {
  1127. return $this->getBoolean("isConfirmationPresent", array());
  1128. }
  1129. /**
  1130. * Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.
  1131. *
  1132. * <p>
  1133. * Getting an alert has the same effect as manually clicking OK. If an
  1134. * alert is generated but you do not get/verify it, the next Selenium action
  1135. * will fail.
  1136. * </p><p>
  1137. * NOTE: under Selenium, JavaScript alerts will NOT pop up a visible alert
  1138. * dialog.
  1139. * </p><p>
  1140. * NOTE: Selenium does NOT support JavaScript alerts that are generated in a
  1141. * page's onload() event handler. In this case a visible dialog WILL be
  1142. * generated and Selenium will hang until someone manually clicks OK.
  1143. * </p>
  1144. *
  1145. * @access public
  1146. * @return string The message of the most recent JavaScript alert
  1147. */
  1148. public function getAlert()
  1149. {
  1150. return $this->getString("getAlert", array());
  1151. }
  1152. /**
  1153. * Retrieves the message of a JavaScript confirmation dialog generated during
  1154. * the previous action.
  1155. *
  1156. * <p>
  1157. *
  1158. * By default, the confirm function will return true, having the same effect
  1159. * as manually clicking OK. This can be changed by prior execution of the
  1160. * chooseCancelOnNextConfirmation command. If an confirmation is generated
  1161. * but you do not get/verify it, the next Selenium action will fail.
  1162. *
  1163. * </p><p>
  1164. *
  1165. * NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible
  1166. * dialog.
  1167. *
  1168. * </p><p>
  1169. *
  1170. * NOTE: Selenium does NOT support JavaScript confirmations that are
  1171. * generated in a page's onload() event handler. In this case a visible
  1172. * dialog WILL be generated and Selenium will hang until you manually click
  1173. * OK.
  1174. *
  1175. * </p>
  1176. *
  1177. * @access public
  1178. * @return string the message of the most recent JavaScript confirmation dialog
  1179. */
  1180. public function getConfirmation()
  1181. {
  1182. return $this->getString("getConfirmation", array());
  1183. }
  1184. /**
  1185. * Retrieves the message of a JavaScript question prompt dialog generated during
  1186. * the previous action.
  1187. *
  1188. * <p>
  1189. * Successful handling of the prompt requires prior execution of the
  1190. * answerOnNextPrompt command. If a prompt is generated but you
  1191. * do not get/verify it, the next Selenium action will fail.
  1192. * </p><p>
  1193. * NOTE: under Selenium, JavaScript prompts will NOT pop up a visible
  1194. * dialog.
  1195. * </p><p>
  1196. * NOTE: Selenium does NOT support JavaScript prompts that are generated in a
  1197. * page's onload() event handler. In this case a visible dialog WILL be
  1198. * generated and Selenium will hang until someone manually clicks OK.
  1199. * </p>
  1200. *
  1201. * @access public
  1202. * @return string the message of the most recent JavaScript question prompt
  1203. */
  1204. public function getPrompt()
  1205. {
  1206. return $this->getString("getPrompt", array());
  1207. }
  1208. /**
  1209. * Gets the absolute URL of the current page.
  1210. *
  1211. * @access public
  1212. * @return string the absolute URL of the current page
  1213. */
  1214. public function getLocation()
  1215. {
  1216. return $this->getString("getLocation", array());
  1217. }
  1218. /**
  1219. * Gets the title of the current page.
  1220. *
  1221. * @access public
  1222. * @return string the title of the current page
  1223. */
  1224. public function getTitle()
  1225. {
  1226. return $this->getString("getTitle", array());
  1227. }
  1228. /**
  1229. * Gets the entire text of the page.
  1230. *
  1231. * @access public
  1232. * @return string the entire text of the page
  1233. */
  1234. public function getBodyText()
  1235. {
  1236. return $this->getString("getBodyText", array());
  1237. }
  1238. /**
  1239. * Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter).
  1240. * For checkbox/radio elements, the value will be "on" or "off" depending on
  1241. * whether the element is checked or not.
  1242. *
  1243. * @access public
  1244. * @param string $locator an element locator
  1245. * @return string the element value, or "on/off" for checkbox/radio elements
  1246. */
  1247. public function getValue($locator)
  1248. {
  1249. return $this->getString("getValue", array($locator));
  1250. }
  1251. /**
  1252. * Gets the text of an element. This works for any element that contains
  1253. * text. This command uses either the textContent (Mozilla-like browsers) or
  1254. * the innerText (IE-like browsers) of the element, which is the rendered
  1255. * text shown to the user.
  1256. *
  1257. * @access public
  1258. * @param string $locator an element locator
  1259. * @return string the text of the element
  1260. */
  1261. public function getText($locator)
  1262. {
  1263. return $this->getString("getText", array($locator));
  1264. }
  1265. /**
  1266. * Briefly changes the backgroundColor of the specified element yellow. Useful for debugging.
  1267. *
  1268. * @access public
  1269. * @param string $locator an element locator
  1270. */
  1271. public function highlight($locator)
  1272. {
  1273. $this->doCommand("highlight", array($locator));
  1274. }
  1275. /**
  1276. * Gets the result of evaluating the specified JavaScript snippet. The snippet may
  1277. * have multiple lines, but only the result of the last line will be returned.
  1278. *
  1279. * <p>
  1280. * Note that, by default, the snippet will run in the context of the "selenium"
  1281. * object itself, so <code>this</code> will refer to the Selenium object. Use <code>window</code> to
  1282. * refer to the window of your application, e.g. <code>window.document.getElementById('foo')</code>
  1283. * </p><p>
  1284. * If you need to use
  1285. * a locator to refer to a single element in your application page, you can
  1286. * use <code>this.browserbot.findElement("id=foo")</code> where "id=foo" is your locator.
  1287. * </p>
  1288. *
  1289. * @access public
  1290. * @param string $script the JavaScript snippet to run
  1291. * @return string the results of evaluating the snippet
  1292. */
  1293. public function getEval($script)
  1294. {
  1295. return $this->getString("getEval", array($script));
  1296. }
  1297. /**
  1298. * Gets whether a toggle-button (checkbox/radio) is checked. Fails if the specified element doesn't exist or isn't a toggle-button.
  1299. *
  1300. * @access public
  1301. * @param string $locator an element locator pointing to a checkbox or radio button
  1302. * @return boolean true if the checkbox is checked, false otherwise
  1303. */
  1304. public function isChecked($locator)
  1305. {
  1306. return $this->getBoolean("isChecked", array($locator));
  1307. }
  1308. /**
  1309. * Gets the text from a cell of a table. The cellAddress syntax
  1310. * tableLocator.row.column, where row and column start at 0.
  1311. *
  1312. * @access public
  1313. * @param string $tableCellAddress a cell address, e.g. "foo.1.4"
  1314. * @return string the text from the specified cell
  1315. */
  1316. public function getTable($tableCellAddress)
  1317. {
  1318. return $this->getString("getTable", array($tableCellAddress));
  1319. }
  1320. /**
  1321. * Gets all option labels (visible text) for selected options in the specified select or multi-select element.
  1322. *
  1323. * @access public
  1324. * @param string $selectLocator an element locator identifying a drop-down menu
  1325. * @return array an array of all selected option labels in the specified select drop-down
  1326. */
  1327. public function getSelectedLabels($selectLocator)
  1328. {
  1329. return $this->getStringArray("getSelectedLabels", array($selectLocator));
  1330. }
  1331. /**
  1332. * Gets option label (visible text) for selected option in the specified select element.
  1333. *
  1334. * @access public
  1335. * @param string $selectLocator an element locator identifying a drop-down menu
  1336. * @return string the selected option label in the specified select drop-down
  1337. */
  1338. public function getSelectedLabel($selectLocator)
  1339. {
  1340. return $this->getString("getSelectedLabel", array($selectLocator));
  1341. }
  1342. /**
  1343. * Gets all option values (value attributes) for selected options in the specified select or multi-select element.
  1344. *
  1345. * @access public
  1346. * @param string $selectLocator an element locator identifying a drop-down menu
  1347. * @return array an array of all selected option values in the specified select drop-down
  1348. */
  1349. public function getSelectedValues($selectLocator)
  1350. {
  1351. return $this->getStringArray("getSelectedValues", array($selectLocator));
  1352. }
  1353. /**
  1354. * Gets option value (value attribute) for selected option in the specified select element.
  1355. *
  1356. * @access public
  1357. * @param string $selectLocator an element locator identifying a drop-down menu
  1358. * @return string the selected option value in the specified select drop-down
  1359. */
  1360. public function getSelectedValue($selectLocator)
  1361. {
  1362. return $this->getString("getSelectedValue", array($selectLocator));
  1363. }
  1364. /**
  1365. * Gets all option indexes (option number, starting at 0) for selected options in the specified select or multi-select element.
  1366. *
  1367. * @access public
  1368. * @param string $selectLocator an element locator identifying a drop-down menu
  1369. * @return array an array of all selected option indexes in the specified select drop-down
  1370. */
  1371. public function getSelectedIndexes($selectLocator)
  1372. {
  1373. return $this->getStringArray("getSelectedIndexes", array($selectLocator));
  1374. }
  1375. /**
  1376. * Gets option index (option number, starting at 0) for selected option in the specified select element.
  1377. *
  1378. * @access public
  1379. * @param string $selectLocator an element locator identifying a drop-down menu
  1380. * @return string the selected option index in the specified select drop-down
  1381. */
  1382. public function getSelectedIndex($selectLocator)
  1383. {
  1384. return $this->getString("getSelectedIndex", array($selectLocator));
  1385. }
  1386. /**
  1387. * Gets all option element IDs for selected options in the specified select or multi-select element.
  1388. *
  1389. * @access public
  1390. * @param string $selectLocator an element locator identifying a drop-down menu
  1391. * @return array an array of all selected option IDs in the specified select drop-down
  1392. */
  1393. public function getSelectedIds($selectLocator)
  1394. {
  1395. return $this->getStringArray("getSelectedIds", array($selectLocator));
  1396. }
  1397. /**
  1398. * Gets option element ID for selected option in the specified select element.
  1399. *
  1400. * @access public
  1401. * @param string $selectLocator an element locator identifying a drop-down menu
  1402. * @return string the selected option ID in the specified select drop-down
  1403. */
  1404. public function getSelectedId($selectLocator)
  1405. {
  1406. return $this->getString("getSelectedId", array($selectLocator));
  1407. }
  1408. /**
  1409. * Determines whether some option in a drop-down menu is selected.
  1410. *
  1411. * @access public
  1412. * @param string $selectLocator an element locator identifying a drop-down menu
  1413. * @return boolean true if some option has been selected, false otherwise
  1414. */
  1415. public function isSomethingSelected($selectLocator)
  1416. {
  1417. return $this->getBoolean("isSomethingSelected", array($selectLocator));
  1418. }
  1419. /**
  1420. * Gets all option labels in the specified select drop-down.
  1421. *
  1422. * @access public
  1423. * @param string $selectLocator an element locator identifying a drop-down menu
  1424. * @return array an array of all option labels in the specified select drop-down
  1425. */
  1426. public function getSelectOptions($selectLocator)
  1427. {
  1428. return $this->getStringArray("getSelectOptions", array($selectLocator));
  1429. }
  1430. /**
  1431. * Gets the value of an element attribute. The value of the attribute may
  1432. * differ across browsers (this is the case for the "style" attribute, for
  1433. * example).
  1434. *
  1435. * @access public
  1436. * @param string $attributeLocator an element locator followed by an @ sign and then the name of the attribute, e.g. "foo@bar"
  1437. * @return string the value of the specified attribute
  1438. */
  1439. public function getAttribute($attributeLocator)
  1440. {
  1441. return $this->getString("getAttribute", array($attributeLocator));
  1442. }
  1443. /**
  1444. * Verifies that the specified text pattern appears somewhere on the rendered page shown to the user.
  1445. *
  1446. * @access public
  1447. * @param string $pattern a pattern to match with the text of the page
  1448. * @return boolean true if the pattern matches the text, false otherwise
  1449. */
  1450. public function isTextPresent($pattern)
  1451. {
  1452. return $this->getBoolean("isTextPresent", array($pattern));
  1453. }
  1454. /**
  1455. * Verifies that the specified element is somewhere on the page.
  1456. *
  1457. * @access public
  1458. * @param string $locator an element locator
  1459. * @return boolean true if the element is present, false otherwise
  1460. */
  1461. public function isElementPresent($locator)
  1462. {
  1463. return $this->getBoolean("isElementPresent", array($locator));
  1464. }
  1465. /**
  1466. * Determines if the specified element is visible. An
  1467. * element can be rendered invisible by setting the CSS "visibility"
  1468. * property to "hidden", or the "display" property to "none", either for the
  1469. * element itself or one if its ancestors. This method will fail if
  1470. * the element is not present.
  1471. *
  1472. * @access public
  1473. * @param string $locator an element locator
  1474. * @return boolean true if the specified element is visible, false otherwise
  1475. */
  1476. public function isVisible($locator)
  1477. {
  1478. return $this->getBoolean("isVisible", array($locator

Large files files are truncated, but you can click here to view the full file