WebGuy.php 83 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683
  1. <?php
  2. // This class was automatically generated by build task
  3. // You should not change it manually as it will be overwritten on next build
  4. // @codingStandardsIgnoreFile
  5. use \Codeception\Maybe;
  6. use Codeception\Module\WebHelper;
  7. use Codeception\Module\WebDriver;
  8. /**
  9. * Inherited methods
  10. * @method void execute($callable)
  11. * @method void wantToTest($text)
  12. * @method void wantTo($text)
  13. * @method void expectTo($prediction)
  14. * @method void expect($prediction)
  15. * @method void amGoingTo($argumentation)
  16. * @method void am($role)
  17. * @method void lookForwardTo($achieveValue)
  18. * @method void offsetGet($offset)
  19. * @method void offsetSet($offset, $value)
  20. * @method void offsetExists($offset)
  21. * @method void offsetUnset($offset)
  22. */
  23. class WebGuy extends \Codeception\AbstractGuy
  24. {
  25. /**
  26. * This method is generated.
  27. * Documentation taken from corresponding module.
  28. * ----------------------------------------------
  29. *
  30. *
  31. * @see Codeception\Module::getName()
  32. * @return \Codeception\Maybe
  33. */
  34. public function getName() {
  35. $this->scenario->addStep(new \Codeception\Step\Action('getName', func_get_args()));
  36. if ($this->scenario->running()) {
  37. $result = $this->scenario->runStep();
  38. return new Maybe($result);
  39. }
  40. return new Maybe();
  41. }
  42. /**
  43. * This method is generated.
  44. * Documentation taken from corresponding module.
  45. * ----------------------------------------------
  46. *
  47. * Sets 'url' configuration parameter to hosts subdomain.
  48. * It does not open a page on subdomain. Use `amOnPage` for that
  49. *
  50. * ``` php
  51. * <?php
  52. * // If config is: 'http://mysite.com'
  53. * // or config is: 'http://www.mysite.com'
  54. * // or config is: 'http://company.mysite.com'
  55. *
  56. * $I->amOnSubdomain('user');
  57. * $I->amOnPage('/');
  58. * // moves to http://user.mysite.com/
  59. * ?>
  60. * ```
  61. * @param $subdomain
  62. * @return mixed
  63. * @see Codeception\Module\WebDriver::amOnSubdomain()
  64. * @return \Codeception\Maybe
  65. */
  66. public function amOnSubdomain($subdomain) {
  67. $this->scenario->addStep(new \Codeception\Step\Condition('amOnSubdomain', func_get_args()));
  68. if ($this->scenario->running()) {
  69. $result = $this->scenario->runStep();
  70. return new Maybe($result);
  71. }
  72. return new Maybe();
  73. }
  74. /**
  75. * This method is generated.
  76. * Documentation taken from corresponding module.
  77. * ----------------------------------------------
  78. *
  79. * Makes a screenshot of current window and saves it to `tests/_log/debug`.
  80. *
  81. * ``` php
  82. * <?php
  83. * $I->amOnPage('/user/edit');
  84. * $I->makeScreenshot('edit page');
  85. * // saved to: tests/_log/debug/UserEdit - edit page.png
  86. * ?>
  87. * ```
  88. *
  89. * @param $name
  90. * @see Codeception\Module\WebDriver::makeScreenshot()
  91. * @return \Codeception\Maybe
  92. */
  93. public function makeScreenshot($name) {
  94. $this->scenario->addStep(new \Codeception\Step\Action('makeScreenshot', func_get_args()));
  95. if ($this->scenario->running()) {
  96. $result = $this->scenario->runStep();
  97. return new Maybe($result);
  98. }
  99. return new Maybe();
  100. }
  101. /**
  102. * This method is generated.
  103. * Documentation taken from corresponding module.
  104. * ----------------------------------------------
  105. *
  106. * Resize current window
  107. *
  108. * Example:
  109. * ``` php
  110. * <?php
  111. * $I->resizeWindow(800, 600);
  112. *
  113. * ```
  114. *
  115. * @param int $width
  116. * @param int $height
  117. * @see Codeception\Module\WebDriver::resizeWindow()
  118. * @return \Codeception\Maybe
  119. */
  120. public function resizeWindow($width, $height) {
  121. $this->scenario->addStep(new \Codeception\Step\Action('resizeWindow', func_get_args()));
  122. if ($this->scenario->running()) {
  123. $result = $this->scenario->runStep();
  124. return new Maybe($result);
  125. }
  126. return new Maybe();
  127. }
  128. /**
  129. * This method is generated.
  130. * Documentation taken from corresponding module.
  131. * ----------------------------------------------
  132. *
  133. * Checks that cookie is set.
  134. *
  135. * @param $cookie
  136. * @return mixed
  137. * Conditional Assertion: Test won't be stopped on fail
  138. * @see Codeception\Module\WebDriver::seeCookie()
  139. * @return \Codeception\Maybe
  140. */
  141. public function canSeeCookie($cookie) {
  142. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCookie', func_get_args()));
  143. if ($this->scenario->running()) {
  144. $result = $this->scenario->runStep();
  145. return new Maybe($result);
  146. }
  147. return new Maybe();
  148. }
  149. /**
  150. * This method is generated.
  151. * Documentation taken from corresponding module.
  152. * ----------------------------------------------
  153. *
  154. * Checks that cookie is set.
  155. *
  156. * @param $cookie
  157. * @return mixed
  158. * @see Codeception\Module\WebDriver::seeCookie()
  159. * @return \Codeception\Maybe
  160. */
  161. public function seeCookie($cookie) {
  162. $this->scenario->addStep(new \Codeception\Step\Assertion('seeCookie', func_get_args()));
  163. if ($this->scenario->running()) {
  164. $result = $this->scenario->runStep();
  165. return new Maybe($result);
  166. }
  167. return new Maybe();
  168. }
  169. /**
  170. * This method is generated.
  171. * Documentation taken from corresponding module.
  172. * ----------------------------------------------
  173. *
  174. * Checks that cookie doesn't exist
  175. *
  176. * @param $cookie
  177. * @return mixed
  178. * Conditional Assertion: Test won't be stopped on fail
  179. * @see Codeception\Module\WebDriver::dontSeeCookie()
  180. * @return \Codeception\Maybe
  181. */
  182. public function cantSeeCookie($cookie) {
  183. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCookie', func_get_args()));
  184. if ($this->scenario->running()) {
  185. $result = $this->scenario->runStep();
  186. return new Maybe($result);
  187. }
  188. return new Maybe();
  189. }
  190. /**
  191. * This method is generated.
  192. * Documentation taken from corresponding module.
  193. * ----------------------------------------------
  194. *
  195. * Checks that cookie doesn't exist
  196. *
  197. * @param $cookie
  198. * @return mixed
  199. * @see Codeception\Module\WebDriver::dontSeeCookie()
  200. * @return \Codeception\Maybe
  201. */
  202. public function dontSeeCookie($cookie) {
  203. $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCookie', func_get_args()));
  204. if ($this->scenario->running()) {
  205. $result = $this->scenario->runStep();
  206. return new Maybe($result);
  207. }
  208. return new Maybe();
  209. }
  210. /**
  211. * This method is generated.
  212. * Documentation taken from corresponding module.
  213. * ----------------------------------------------
  214. *
  215. * Sets a cookie.
  216. *
  217. * @param $cookie
  218. * @param $value
  219. * @return mixed
  220. * @see Codeception\Module\WebDriver::setCookie()
  221. * @return \Codeception\Maybe
  222. */
  223. public function setCookie($cookie, $value) {
  224. $this->scenario->addStep(new \Codeception\Step\Action('setCookie', func_get_args()));
  225. if ($this->scenario->running()) {
  226. $result = $this->scenario->runStep();
  227. return new Maybe($result);
  228. }
  229. return new Maybe();
  230. }
  231. /**
  232. * This method is generated.
  233. * Documentation taken from corresponding module.
  234. * ----------------------------------------------
  235. *
  236. * Unsets cookie
  237. *
  238. * @param $cookie
  239. * @return mixed
  240. * @see Codeception\Module\WebDriver::resetCookie()
  241. * @return \Codeception\Maybe
  242. */
  243. public function resetCookie($cookie) {
  244. $this->scenario->addStep(new \Codeception\Step\Action('resetCookie', func_get_args()));
  245. if ($this->scenario->running()) {
  246. $result = $this->scenario->runStep();
  247. return new Maybe($result);
  248. }
  249. return new Maybe();
  250. }
  251. /**
  252. * This method is generated.
  253. * Documentation taken from corresponding module.
  254. * ----------------------------------------------
  255. *
  256. * Grabs a cookie value.
  257. *
  258. * @param $cookie
  259. * @return mixed
  260. * @see Codeception\Module\WebDriver::grabCookie()
  261. * @return \Codeception\Maybe
  262. */
  263. public function grabCookie($cookie) {
  264. $this->scenario->addStep(new \Codeception\Step\Action('grabCookie', func_get_args()));
  265. if ($this->scenario->running()) {
  266. $result = $this->scenario->runStep();
  267. return new Maybe($result);
  268. }
  269. return new Maybe();
  270. }
  271. /**
  272. * This method is generated.
  273. * Documentation taken from corresponding module.
  274. * ----------------------------------------------
  275. *
  276. * Opens the page.
  277. * Requires relative uri as parameter
  278. *
  279. * Example:
  280. *
  281. * ``` php
  282. * <?php
  283. * // opens front page
  284. * $I->amOnPage('/');
  285. * // opens /register page
  286. * $I->amOnPage('/register');
  287. * ?>
  288. * ```
  289. *
  290. * @param $page
  291. * @see Codeception\Module\WebDriver::amOnPage()
  292. * @return \Codeception\Maybe
  293. */
  294. public function amOnPage($page) {
  295. $this->scenario->addStep(new \Codeception\Step\Condition('amOnPage', func_get_args()));
  296. if ($this->scenario->running()) {
  297. $result = $this->scenario->runStep();
  298. return new Maybe($result);
  299. }
  300. return new Maybe();
  301. }
  302. /**
  303. * This method is generated.
  304. * Documentation taken from corresponding module.
  305. * ----------------------------------------------
  306. *
  307. * Check if current page contains the text specified.
  308. * Specify the css selector to match only specific region.
  309. *
  310. * Examples:
  311. *
  312. * ``` php
  313. * <?php
  314. * $I->see('Logout'); // I can suppose user is logged in
  315. * $I->see('Sign Up','h1'); // I can suppose it's a signup page
  316. * $I->see('Sign Up','//body/h1'); // with XPath
  317. * ?>
  318. * ```
  319. *
  320. * @param $text
  321. * @param null $selector
  322. * Conditional Assertion: Test won't be stopped on fail
  323. * @see Codeception\Module\WebDriver::see()
  324. * @return \Codeception\Maybe
  325. */
  326. public function canSee($text, $selector = null) {
  327. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('see', func_get_args()));
  328. if ($this->scenario->running()) {
  329. $result = $this->scenario->runStep();
  330. return new Maybe($result);
  331. }
  332. return new Maybe();
  333. }
  334. /**
  335. * This method is generated.
  336. * Documentation taken from corresponding module.
  337. * ----------------------------------------------
  338. *
  339. * Check if current page contains the text specified.
  340. * Specify the css selector to match only specific region.
  341. *
  342. * Examples:
  343. *
  344. * ``` php
  345. * <?php
  346. * $I->see('Logout'); // I can suppose user is logged in
  347. * $I->see('Sign Up','h1'); // I can suppose it's a signup page
  348. * $I->see('Sign Up','//body/h1'); // with XPath
  349. * ?>
  350. * ```
  351. *
  352. * @param $text
  353. * @param null $selector
  354. * @see Codeception\Module\WebDriver::see()
  355. * @return \Codeception\Maybe
  356. */
  357. public function see($text, $selector = null) {
  358. $this->scenario->addStep(new \Codeception\Step\Assertion('see', func_get_args()));
  359. if ($this->scenario->running()) {
  360. $result = $this->scenario->runStep();
  361. return new Maybe($result);
  362. }
  363. return new Maybe();
  364. }
  365. /**
  366. * This method is generated.
  367. * Documentation taken from corresponding module.
  368. * ----------------------------------------------
  369. *
  370. * Check if current page doesn't contain the text specified.
  371. * Specify the css selector to match only specific region.
  372. *
  373. * Examples:
  374. *
  375. * ```php
  376. * <?php
  377. * $I->dontSee('Login'); // I can suppose user is already logged in
  378. * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
  379. * $I->dontSee('Sign Up','//body/h1'); // with XPath
  380. * ?>
  381. * ```
  382. *
  383. * @param $text
  384. * @param null $selector
  385. * Conditional Assertion: Test won't be stopped on fail
  386. * @see Codeception\Module\WebDriver::dontSee()
  387. * @return \Codeception\Maybe
  388. */
  389. public function cantSee($text, $selector = null) {
  390. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSee', func_get_args()));
  391. if ($this->scenario->running()) {
  392. $result = $this->scenario->runStep();
  393. return new Maybe($result);
  394. }
  395. return new Maybe();
  396. }
  397. /**
  398. * This method is generated.
  399. * Documentation taken from corresponding module.
  400. * ----------------------------------------------
  401. *
  402. * Check if current page doesn't contain the text specified.
  403. * Specify the css selector to match only specific region.
  404. *
  405. * Examples:
  406. *
  407. * ```php
  408. * <?php
  409. * $I->dontSee('Login'); // I can suppose user is already logged in
  410. * $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
  411. * $I->dontSee('Sign Up','//body/h1'); // with XPath
  412. * ?>
  413. * ```
  414. *
  415. * @param $text
  416. * @param null $selector
  417. * @see Codeception\Module\WebDriver::dontSee()
  418. * @return \Codeception\Maybe
  419. */
  420. public function dontSee($text, $selector = null) {
  421. $this->scenario->addStep(new \Codeception\Step\Assertion('dontSee', func_get_args()));
  422. if ($this->scenario->running()) {
  423. $result = $this->scenario->runStep();
  424. return new Maybe($result);
  425. }
  426. return new Maybe();
  427. }
  428. /**
  429. * This method is generated.
  430. * Documentation taken from corresponding module.
  431. * ----------------------------------------------
  432. *
  433. * Perform a click on link or button.
  434. * Link or button are found by their names or CSS selector.
  435. * Submits a form if button is a submit type.
  436. *
  437. * If link is an image it's found by alt attribute value of image.
  438. * If button is image button is found by it's value
  439. * If link or button can't be found by name they are searched by CSS selector.
  440. *
  441. * The second parameter is a context: CSS or XPath locator to narrow the search.
  442. *
  443. * Examples:
  444. *
  445. * ``` php
  446. * <?php
  447. * // simple link
  448. * $I->click('Logout');
  449. * // button of form
  450. * $I->click('Submit');
  451. * // CSS button
  452. * $I->click('#form input[type=submit]');
  453. * // XPath
  454. * $I->click('//form/*[@type=submit]')
  455. * // link in context
  456. * $I->click('Logout', '#nav');
  457. * ?>
  458. * ```
  459. * @param $link
  460. * @param $context
  461. * @see Codeception\Module\WebDriver::click()
  462. * @return \Codeception\Maybe
  463. */
  464. public function click($link, $context = null) {
  465. $this->scenario->addStep(new \Codeception\Step\Action('click', func_get_args()));
  466. if ($this->scenario->running()) {
  467. $result = $this->scenario->runStep();
  468. return new Maybe($result);
  469. }
  470. return new Maybe();
  471. }
  472. /**
  473. * This method is generated.
  474. * Documentation taken from corresponding module.
  475. * ----------------------------------------------
  476. *
  477. * Checks if there is a link with text specified.
  478. * Specify url to match link with exact this url.
  479. *
  480. * Examples:
  481. *
  482. * ``` php
  483. * <?php
  484. * $I->seeLink('Logout'); // matches <a href="#">Logout</a>
  485. * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
  486. * ?>
  487. * ```
  488. *
  489. * @param $text
  490. * @param null $url
  491. * Conditional Assertion: Test won't be stopped on fail
  492. * @see Codeception\Module\WebDriver::seeLink()
  493. * @return \Codeception\Maybe
  494. */
  495. public function canSeeLink($text, $url = null) {
  496. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeLink', func_get_args()));
  497. if ($this->scenario->running()) {
  498. $result = $this->scenario->runStep();
  499. return new Maybe($result);
  500. }
  501. return new Maybe();
  502. }
  503. /**
  504. * This method is generated.
  505. * Documentation taken from corresponding module.
  506. * ----------------------------------------------
  507. *
  508. * Checks if there is a link with text specified.
  509. * Specify url to match link with exact this url.
  510. *
  511. * Examples:
  512. *
  513. * ``` php
  514. * <?php
  515. * $I->seeLink('Logout'); // matches <a href="#">Logout</a>
  516. * $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
  517. * ?>
  518. * ```
  519. *
  520. * @param $text
  521. * @param null $url
  522. * @see Codeception\Module\WebDriver::seeLink()
  523. * @return \Codeception\Maybe
  524. */
  525. public function seeLink($text, $url = null) {
  526. $this->scenario->addStep(new \Codeception\Step\Assertion('seeLink', func_get_args()));
  527. if ($this->scenario->running()) {
  528. $result = $this->scenario->runStep();
  529. return new Maybe($result);
  530. }
  531. return new Maybe();
  532. }
  533. /**
  534. * This method is generated.
  535. * Documentation taken from corresponding module.
  536. * ----------------------------------------------
  537. *
  538. * Checks if page doesn't contain the link with text specified.
  539. * Specify url to narrow the results.
  540. *
  541. * Examples:
  542. *
  543. * ``` php
  544. * <?php
  545. * $I->dontSeeLink('Logout'); // I suppose user is not logged in
  546. * ?>
  547. * ```
  548. *
  549. * @param $text
  550. * @param null $url
  551. * Conditional Assertion: Test won't be stopped on fail
  552. * @see Codeception\Module\WebDriver::dontSeeLink()
  553. * @return \Codeception\Maybe
  554. */
  555. public function cantSeeLink($text, $url = null) {
  556. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeLink', func_get_args()));
  557. if ($this->scenario->running()) {
  558. $result = $this->scenario->runStep();
  559. return new Maybe($result);
  560. }
  561. return new Maybe();
  562. }
  563. /**
  564. * This method is generated.
  565. * Documentation taken from corresponding module.
  566. * ----------------------------------------------
  567. *
  568. * Checks if page doesn't contain the link with text specified.
  569. * Specify url to narrow the results.
  570. *
  571. * Examples:
  572. *
  573. * ``` php
  574. * <?php
  575. * $I->dontSeeLink('Logout'); // I suppose user is not logged in
  576. * ?>
  577. * ```
  578. *
  579. * @param $text
  580. * @param null $url
  581. * @see Codeception\Module\WebDriver::dontSeeLink()
  582. * @return \Codeception\Maybe
  583. */
  584. public function dontSeeLink($text, $url = null) {
  585. $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeLink', func_get_args()));
  586. if ($this->scenario->running()) {
  587. $result = $this->scenario->runStep();
  588. return new Maybe($result);
  589. }
  590. return new Maybe();
  591. }
  592. /**
  593. * This method is generated.
  594. * Documentation taken from corresponding module.
  595. * ----------------------------------------------
  596. *
  597. * Checks that current uri contains a value
  598. *
  599. * ``` php
  600. * <?php
  601. * // to match: /home/dashboard
  602. * $I->seeInCurrentUrl('home');
  603. * // to match: /users/1
  604. * $I->seeInCurrentUrl('/users/');
  605. * ?>
  606. * ```
  607. *
  608. * @param $uri
  609. * Conditional Assertion: Test won't be stopped on fail
  610. * @see Codeception\Module\WebDriver::seeInCurrentUrl()
  611. * @return \Codeception\Maybe
  612. */
  613. public function canSeeInCurrentUrl($uri) {
  614. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInCurrentUrl', func_get_args()));
  615. if ($this->scenario->running()) {
  616. $result = $this->scenario->runStep();
  617. return new Maybe($result);
  618. }
  619. return new Maybe();
  620. }
  621. /**
  622. * This method is generated.
  623. * Documentation taken from corresponding module.
  624. * ----------------------------------------------
  625. *
  626. * Checks that current uri contains a value
  627. *
  628. * ``` php
  629. * <?php
  630. * // to match: /home/dashboard
  631. * $I->seeInCurrentUrl('home');
  632. * // to match: /users/1
  633. * $I->seeInCurrentUrl('/users/');
  634. * ?>
  635. * ```
  636. *
  637. * @param $uri
  638. * @see Codeception\Module\WebDriver::seeInCurrentUrl()
  639. * @return \Codeception\Maybe
  640. */
  641. public function seeInCurrentUrl($uri) {
  642. $this->scenario->addStep(new \Codeception\Step\Assertion('seeInCurrentUrl', func_get_args()));
  643. if ($this->scenario->running()) {
  644. $result = $this->scenario->runStep();
  645. return new Maybe($result);
  646. }
  647. return new Maybe();
  648. }
  649. /**
  650. * This method is generated.
  651. * Documentation taken from corresponding module.
  652. * ----------------------------------------------
  653. *
  654. * Checks that current url is equal to value.
  655. * Unlike `seeInCurrentUrl` performs a strict check.
  656. *
  657. * ``` php
  658. * <?php
  659. * // to match root url
  660. * $I->seeCurrentUrlEquals('/');
  661. * ?>
  662. * ```
  663. *
  664. * @param $uri
  665. * Conditional Assertion: Test won't be stopped on fail
  666. * @see Codeception\Module\WebDriver::seeCurrentUrlEquals()
  667. * @return \Codeception\Maybe
  668. */
  669. public function canSeeCurrentUrlEquals($uri) {
  670. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlEquals', func_get_args()));
  671. if ($this->scenario->running()) {
  672. $result = $this->scenario->runStep();
  673. return new Maybe($result);
  674. }
  675. return new Maybe();
  676. }
  677. /**
  678. * This method is generated.
  679. * Documentation taken from corresponding module.
  680. * ----------------------------------------------
  681. *
  682. * Checks that current url is equal to value.
  683. * Unlike `seeInCurrentUrl` performs a strict check.
  684. *
  685. * ``` php
  686. * <?php
  687. * // to match root url
  688. * $I->seeCurrentUrlEquals('/');
  689. * ?>
  690. * ```
  691. *
  692. * @param $uri
  693. * @see Codeception\Module\WebDriver::seeCurrentUrlEquals()
  694. * @return \Codeception\Maybe
  695. */
  696. public function seeCurrentUrlEquals($uri) {
  697. $this->scenario->addStep(new \Codeception\Step\Assertion('seeCurrentUrlEquals', func_get_args()));
  698. if ($this->scenario->running()) {
  699. $result = $this->scenario->runStep();
  700. return new Maybe($result);
  701. }
  702. return new Maybe();
  703. }
  704. /**
  705. * This method is generated.
  706. * Documentation taken from corresponding module.
  707. * ----------------------------------------------
  708. *
  709. * Checks that current url is matches a RegEx value
  710. *
  711. * ``` php
  712. * <?php
  713. * // to match root url
  714. * $I->seeCurrentUrlMatches('~$/users/(\d+)~');
  715. * ?>
  716. * ```
  717. *
  718. * @param $uri
  719. * Conditional Assertion: Test won't be stopped on fail
  720. * @see Codeception\Module\WebDriver::seeCurrentUrlMatches()
  721. * @return \Codeception\Maybe
  722. */
  723. public function canSeeCurrentUrlMatches($uri) {
  724. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCurrentUrlMatches', func_get_args()));
  725. if ($this->scenario->running()) {
  726. $result = $this->scenario->runStep();
  727. return new Maybe($result);
  728. }
  729. return new Maybe();
  730. }
  731. /**
  732. * This method is generated.
  733. * Documentation taken from corresponding module.
  734. * ----------------------------------------------
  735. *
  736. * Checks that current url is matches a RegEx value
  737. *
  738. * ``` php
  739. * <?php
  740. * // to match root url
  741. * $I->seeCurrentUrlMatches('~$/users/(\d+)~');
  742. * ?>
  743. * ```
  744. *
  745. * @param $uri
  746. * @see Codeception\Module\WebDriver::seeCurrentUrlMatches()
  747. * @return \Codeception\Maybe
  748. */
  749. public function seeCurrentUrlMatches($uri) {
  750. $this->scenario->addStep(new \Codeception\Step\Assertion('seeCurrentUrlMatches', func_get_args()));
  751. if ($this->scenario->running()) {
  752. $result = $this->scenario->runStep();
  753. return new Maybe($result);
  754. }
  755. return new Maybe();
  756. }
  757. /**
  758. * This method is generated.
  759. * Documentation taken from corresponding module.
  760. * ----------------------------------------------
  761. *
  762. * Checks that current uri does not contain a value
  763. *
  764. * ``` php
  765. * <?php
  766. * $I->dontSeeInCurrentUrl('/users/');
  767. * ?>
  768. * ```
  769. *
  770. * @param $uri
  771. * Conditional Assertion: Test won't be stopped on fail
  772. * @see Codeception\Module\WebDriver::dontSeeInCurrentUrl()
  773. * @return \Codeception\Maybe
  774. */
  775. public function cantSeeInCurrentUrl($uri) {
  776. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInCurrentUrl', func_get_args()));
  777. if ($this->scenario->running()) {
  778. $result = $this->scenario->runStep();
  779. return new Maybe($result);
  780. }
  781. return new Maybe();
  782. }
  783. /**
  784. * This method is generated.
  785. * Documentation taken from corresponding module.
  786. * ----------------------------------------------
  787. *
  788. * Checks that current uri does not contain a value
  789. *
  790. * ``` php
  791. * <?php
  792. * $I->dontSeeInCurrentUrl('/users/');
  793. * ?>
  794. * ```
  795. *
  796. * @param $uri
  797. * @see Codeception\Module\WebDriver::dontSeeInCurrentUrl()
  798. * @return \Codeception\Maybe
  799. */
  800. public function dontSeeInCurrentUrl($uri) {
  801. $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInCurrentUrl', func_get_args()));
  802. if ($this->scenario->running()) {
  803. $result = $this->scenario->runStep();
  804. return new Maybe($result);
  805. }
  806. return new Maybe();
  807. }
  808. /**
  809. * This method is generated.
  810. * Documentation taken from corresponding module.
  811. * ----------------------------------------------
  812. *
  813. * Checks that current url is not equal to value.
  814. * Unlike `dontSeeInCurrentUrl` performs a strict check.
  815. *
  816. * ``` php
  817. * <?php
  818. * // current url is not root
  819. * $I->dontSeeCurrentUrlEquals('/');
  820. * ?>
  821. * ```
  822. *
  823. * @param $uri
  824. * Conditional Assertion: Test won't be stopped on fail
  825. * @see Codeception\Module\WebDriver::dontSeeCurrentUrlEquals()
  826. * @return \Codeception\Maybe
  827. */
  828. public function cantSeeCurrentUrlEquals($uri) {
  829. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlEquals', func_get_args()));
  830. if ($this->scenario->running()) {
  831. $result = $this->scenario->runStep();
  832. return new Maybe($result);
  833. }
  834. return new Maybe();
  835. }
  836. /**
  837. * This method is generated.
  838. * Documentation taken from corresponding module.
  839. * ----------------------------------------------
  840. *
  841. * Checks that current url is not equal to value.
  842. * Unlike `dontSeeInCurrentUrl` performs a strict check.
  843. *
  844. * ``` php
  845. * <?php
  846. * // current url is not root
  847. * $I->dontSeeCurrentUrlEquals('/');
  848. * ?>
  849. * ```
  850. *
  851. * @param $uri
  852. * @see Codeception\Module\WebDriver::dontSeeCurrentUrlEquals()
  853. * @return \Codeception\Maybe
  854. */
  855. public function dontSeeCurrentUrlEquals($uri) {
  856. $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlEquals', func_get_args()));
  857. if ($this->scenario->running()) {
  858. $result = $this->scenario->runStep();
  859. return new Maybe($result);
  860. }
  861. return new Maybe();
  862. }
  863. /**
  864. * This method is generated.
  865. * Documentation taken from corresponding module.
  866. * ----------------------------------------------
  867. *
  868. * Checks that current url does not match a RegEx value
  869. *
  870. * ``` php
  871. * <?php
  872. * // to match root url
  873. * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
  874. * ?>
  875. * ```
  876. *
  877. * @param $uri
  878. * Conditional Assertion: Test won't be stopped on fail
  879. * @see Codeception\Module\WebDriver::dontSeeCurrentUrlMatches()
  880. * @return \Codeception\Maybe
  881. */
  882. public function cantSeeCurrentUrlMatches($uri) {
  883. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCurrentUrlMatches', func_get_args()));
  884. if ($this->scenario->running()) {
  885. $result = $this->scenario->runStep();
  886. return new Maybe($result);
  887. }
  888. return new Maybe();
  889. }
  890. /**
  891. * This method is generated.
  892. * Documentation taken from corresponding module.
  893. * ----------------------------------------------
  894. *
  895. * Checks that current url does not match a RegEx value
  896. *
  897. * ``` php
  898. * <?php
  899. * // to match root url
  900. * $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
  901. * ?>
  902. * ```
  903. *
  904. * @param $uri
  905. * @see Codeception\Module\WebDriver::dontSeeCurrentUrlMatches()
  906. * @return \Codeception\Maybe
  907. */
  908. public function dontSeeCurrentUrlMatches($uri) {
  909. $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCurrentUrlMatches', func_get_args()));
  910. if ($this->scenario->running()) {
  911. $result = $this->scenario->runStep();
  912. return new Maybe($result);
  913. }
  914. return new Maybe();
  915. }
  916. /**
  917. * This method is generated.
  918. * Documentation taken from corresponding module.
  919. * ----------------------------------------------
  920. *
  921. * Takes a parameters from current URI by RegEx.
  922. * If no url provided returns full URI.
  923. *
  924. * ``` php
  925. * <?php
  926. * $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~');
  927. * $uri = $I->grabFromCurrentUrl();
  928. * ?>
  929. * ```
  930. *
  931. * @param null $uri
  932. * @internal param $url
  933. * @return mixed
  934. * @see Codeception\Module\WebDriver::grabFromCurrentUrl()
  935. * @return \Codeception\Maybe
  936. */
  937. public function grabFromCurrentUrl($uri = null) {
  938. $this->scenario->addStep(new \Codeception\Step\Action('grabFromCurrentUrl', func_get_args()));
  939. if ($this->scenario->running()) {
  940. $result = $this->scenario->runStep();
  941. return new Maybe($result);
  942. }
  943. return new Maybe();
  944. }
  945. /**
  946. * This method is generated.
  947. * Documentation taken from corresponding module.
  948. * ----------------------------------------------
  949. *
  950. * Assert if the specified checkbox is checked.
  951. * Use css selector or xpath to match.
  952. *
  953. * Example:
  954. *
  955. * ``` php
  956. * <?php
  957. * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
  958. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
  959. * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
  960. * ?>
  961. * ```
  962. *
  963. * @param $checkbox
  964. * Conditional Assertion: Test won't be stopped on fail
  965. * @see Codeception\Module\WebDriver::seeCheckboxIsChecked()
  966. * @return \Codeception\Maybe
  967. */
  968. public function canSeeCheckboxIsChecked($checkbox) {
  969. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeCheckboxIsChecked', func_get_args()));
  970. if ($this->scenario->running()) {
  971. $result = $this->scenario->runStep();
  972. return new Maybe($result);
  973. }
  974. return new Maybe();
  975. }
  976. /**
  977. * This method is generated.
  978. * Documentation taken from corresponding module.
  979. * ----------------------------------------------
  980. *
  981. * Assert if the specified checkbox is checked.
  982. * Use css selector or xpath to match.
  983. *
  984. * Example:
  985. *
  986. * ``` php
  987. * <?php
  988. * $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms
  989. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
  990. * $I->seeCheckboxIsChecked('//form/input[@type=checkbox and @name=agree]');
  991. * ?>
  992. * ```
  993. *
  994. * @param $checkbox
  995. * @see Codeception\Module\WebDriver::seeCheckboxIsChecked()
  996. * @return \Codeception\Maybe
  997. */
  998. public function seeCheckboxIsChecked($checkbox) {
  999. $this->scenario->addStep(new \Codeception\Step\Assertion('seeCheckboxIsChecked', func_get_args()));
  1000. if ($this->scenario->running()) {
  1001. $result = $this->scenario->runStep();
  1002. return new Maybe($result);
  1003. }
  1004. return new Maybe();
  1005. }
  1006. /**
  1007. * This method is generated.
  1008. * Documentation taken from corresponding module.
  1009. * ----------------------------------------------
  1010. *
  1011. * Assert if the specified checkbox is unchecked.
  1012. * Use css selector or xpath to match.
  1013. *
  1014. * Example:
  1015. *
  1016. * ``` php
  1017. * <?php
  1018. * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
  1019. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
  1020. * ?>
  1021. * ```
  1022. *
  1023. * @param $checkbox
  1024. * Conditional Assertion: Test won't be stopped on fail
  1025. * @see Codeception\Module\WebDriver::dontSeeCheckboxIsChecked()
  1026. * @return \Codeception\Maybe
  1027. */
  1028. public function cantSeeCheckboxIsChecked($checkbox) {
  1029. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeCheckboxIsChecked', func_get_args()));
  1030. if ($this->scenario->running()) {
  1031. $result = $this->scenario->runStep();
  1032. return new Maybe($result);
  1033. }
  1034. return new Maybe();
  1035. }
  1036. /**
  1037. * This method is generated.
  1038. * Documentation taken from corresponding module.
  1039. * ----------------------------------------------
  1040. *
  1041. * Assert if the specified checkbox is unchecked.
  1042. * Use css selector or xpath to match.
  1043. *
  1044. * Example:
  1045. *
  1046. * ``` php
  1047. * <?php
  1048. * $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms
  1049. * $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
  1050. * ?>
  1051. * ```
  1052. *
  1053. * @param $checkbox
  1054. * @see Codeception\Module\WebDriver::dontSeeCheckboxIsChecked()
  1055. * @return \Codeception\Maybe
  1056. */
  1057. public function dontSeeCheckboxIsChecked($checkbox) {
  1058. $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeCheckboxIsChecked', func_get_args()));
  1059. if ($this->scenario->running()) {
  1060. $result = $this->scenario->runStep();
  1061. return new Maybe($result);
  1062. }
  1063. return new Maybe();
  1064. }
  1065. /**
  1066. * This method is generated.
  1067. * Documentation taken from corresponding module.
  1068. * ----------------------------------------------
  1069. *
  1070. * Checks that an input field or textarea contains value.
  1071. * Field is matched either by label or CSS or Xpath
  1072. *
  1073. * Example:
  1074. *
  1075. * ``` php
  1076. * <?php
  1077. * $I->seeInField('Body','Type your comment here');
  1078. * $I->seeInField('form textarea[name=body]','Type your comment here');
  1079. * $I->seeInField('form input[type=hidden]','hidden_value');
  1080. * $I->seeInField('#searchform input','Search');
  1081. * $I->seeInField('//form/*[@name=search]','Search');
  1082. * ?>
  1083. * ```
  1084. *
  1085. * @param $field
  1086. * @param $value
  1087. * Conditional Assertion: Test won't be stopped on fail
  1088. * @see Codeception\Module\WebDriver::seeInField()
  1089. * @return \Codeception\Maybe
  1090. */
  1091. public function canSeeInField($field, $value) {
  1092. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInField', func_get_args()));
  1093. if ($this->scenario->running()) {
  1094. $result = $this->scenario->runStep();
  1095. return new Maybe($result);
  1096. }
  1097. return new Maybe();
  1098. }
  1099. /**
  1100. * This method is generated.
  1101. * Documentation taken from corresponding module.
  1102. * ----------------------------------------------
  1103. *
  1104. * Checks that an input field or textarea contains value.
  1105. * Field is matched either by label or CSS or Xpath
  1106. *
  1107. * Example:
  1108. *
  1109. * ``` php
  1110. * <?php
  1111. * $I->seeInField('Body','Type your comment here');
  1112. * $I->seeInField('form textarea[name=body]','Type your comment here');
  1113. * $I->seeInField('form input[type=hidden]','hidden_value');
  1114. * $I->seeInField('#searchform input','Search');
  1115. * $I->seeInField('//form/*[@name=search]','Search');
  1116. * ?>
  1117. * ```
  1118. *
  1119. * @param $field
  1120. * @param $value
  1121. * @see Codeception\Module\WebDriver::seeInField()
  1122. * @return \Codeception\Maybe
  1123. */
  1124. public function seeInField($field, $value) {
  1125. $this->scenario->addStep(new \Codeception\Step\Assertion('seeInField', func_get_args()));
  1126. if ($this->scenario->running()) {
  1127. $result = $this->scenario->runStep();
  1128. return new Maybe($result);
  1129. }
  1130. return new Maybe();
  1131. }
  1132. /**
  1133. * This method is generated.
  1134. * Documentation taken from corresponding module.
  1135. * ----------------------------------------------
  1136. *
  1137. * Checks that an input field or textarea doesn't contain value.
  1138. * Field is matched either by label or CSS or Xpath
  1139. * Example:
  1140. *
  1141. * ``` php
  1142. * <?php
  1143. * $I->dontSeeInField('Body','Type your comment here');
  1144. * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
  1145. * $I->dontSeeInField('form input[type=hidden]','hidden_value');
  1146. * $I->dontSeeInField('#searchform input','Search');
  1147. * $I->dontSeeInField('//form/*[@name=search]','Search');
  1148. * ?>
  1149. * ```
  1150. *
  1151. * @param $field
  1152. * @param $value
  1153. * Conditional Assertion: Test won't be stopped on fail
  1154. * @see Codeception\Module\WebDriver::dontSeeInField()
  1155. * @return \Codeception\Maybe
  1156. */
  1157. public function cantSeeInField($field, $value) {
  1158. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInField', func_get_args()));
  1159. if ($this->scenario->running()) {
  1160. $result = $this->scenario->runStep();
  1161. return new Maybe($result);
  1162. }
  1163. return new Maybe();
  1164. }
  1165. /**
  1166. * This method is generated.
  1167. * Documentation taken from corresponding module.
  1168. * ----------------------------------------------
  1169. *
  1170. * Checks that an input field or textarea doesn't contain value.
  1171. * Field is matched either by label or CSS or Xpath
  1172. * Example:
  1173. *
  1174. * ``` php
  1175. * <?php
  1176. * $I->dontSeeInField('Body','Type your comment here');
  1177. * $I->dontSeeInField('form textarea[name=body]','Type your comment here');
  1178. * $I->dontSeeInField('form input[type=hidden]','hidden_value');
  1179. * $I->dontSeeInField('#searchform input','Search');
  1180. * $I->dontSeeInField('//form/*[@name=search]','Search');
  1181. * ?>
  1182. * ```
  1183. *
  1184. * @param $field
  1185. * @param $value
  1186. * @see Codeception\Module\WebDriver::dontSeeInField()
  1187. * @return \Codeception\Maybe
  1188. */
  1189. public function dontSeeInField($field, $value) {
  1190. $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInField', func_get_args()));
  1191. if ($this->scenario->running()) {
  1192. $result = $this->scenario->runStep();
  1193. return new Maybe($result);
  1194. }
  1195. return new Maybe();
  1196. }
  1197. /**
  1198. * This method is generated.
  1199. * Documentation taken from corresponding module.
  1200. * ----------------------------------------------
  1201. *
  1202. * Selects an option in select tag or in radio button group.
  1203. *
  1204. * Example:
  1205. *
  1206. * ``` php
  1207. * <?php
  1208. * $I->selectOption('form select[name=account]', 'Premium');
  1209. * $I->selectOption('form input[name=payment]', 'Monthly');
  1210. * $I->selectOption('//form/select[@name=account]', 'Monthly');
  1211. * ?>
  1212. * ```
  1213. *
  1214. * Can select multiple options if second argument is array:
  1215. *
  1216. * ``` php
  1217. * <?php
  1218. * $I->selectOption('Which OS do you use?', array('Windows','Linux'));
  1219. * ?>
  1220. * ```
  1221. *
  1222. * @param $select
  1223. * @param $option
  1224. * @see Codeception\Module\WebDriver::selectOption()
  1225. * @return \Codeception\Maybe
  1226. */
  1227. public function selectOption($select, $option) {
  1228. $this->scenario->addStep(new \Codeception\Step\Action('selectOption', func_get_args()));
  1229. if ($this->scenario->running()) {
  1230. $result = $this->scenario->runStep();
  1231. return new Maybe($result);
  1232. }
  1233. return new Maybe();
  1234. }
  1235. /**
  1236. * This method is generated.
  1237. * Documentation taken from corresponding module.
  1238. * ----------------------------------------------
  1239. *
  1240. *
  1241. * @see Codeception\Module\WebDriver::unselectOption()
  1242. * @return \Codeception\Maybe
  1243. */
  1244. public function unselectOption($select, $option) {
  1245. $this->scenario->addStep(new \Codeception\Step\Action('unselectOption', func_get_args()));
  1246. if ($this->scenario->running()) {
  1247. $result = $this->scenario->runStep();
  1248. return new Maybe($result);
  1249. }
  1250. return new Maybe();
  1251. }
  1252. /**
  1253. * This method is generated.
  1254. * Documentation taken from corresponding module.
  1255. * ----------------------------------------------
  1256. *
  1257. * Ticks a checkbox.
  1258. * For radio buttons use `selectOption` method.
  1259. *
  1260. * Example:
  1261. *
  1262. * ``` php
  1263. * <?php
  1264. * $I->checkOption('#agree');
  1265. * ?>
  1266. * ```
  1267. *
  1268. * @param $option
  1269. * @see Codeception\Module\WebDriver::checkOption()
  1270. * @return \Codeception\Maybe
  1271. */
  1272. public function checkOption($option) {
  1273. $this->scenario->addStep(new \Codeception\Step\Action('checkOption', func_get_args()));
  1274. if ($this->scenario->running()) {
  1275. $result = $this->scenario->runStep();
  1276. return new Maybe($result);
  1277. }
  1278. return new Maybe();
  1279. }
  1280. /**
  1281. * This method is generated.
  1282. * Documentation taken from corresponding module.
  1283. * ----------------------------------------------
  1284. *
  1285. * Unticks a checkbox.
  1286. *
  1287. * Example:
  1288. *
  1289. * ``` php
  1290. * <?php
  1291. * $I->uncheckOption('#notify');
  1292. * ?>
  1293. * ```
  1294. *
  1295. * @param $option
  1296. * @see Codeception\Module\WebDriver::uncheckOption()
  1297. * @return \Codeception\Maybe
  1298. */
  1299. public function uncheckOption($option) {
  1300. $this->scenario->addStep(new \Codeception\Step\Action('uncheckOption', func_get_args()));
  1301. if ($this->scenario->running()) {
  1302. $result = $this->scenario->runStep();
  1303. return new Maybe($result);
  1304. }
  1305. return new Maybe();
  1306. }
  1307. /**
  1308. * This method is generated.
  1309. * Documentation taken from corresponding module.
  1310. * ----------------------------------------------
  1311. *
  1312. * Fills a text field or textarea with value.
  1313. *
  1314. * Example:
  1315. *
  1316. * ``` php
  1317. * <?php
  1318. * $I->fillField("//input[@type='text']", "Hello World!");
  1319. * ?>
  1320. * ```
  1321. *
  1322. * @param $field
  1323. * @param $value
  1324. * @see Codeception\Module\WebDriver::fillField()
  1325. * @return \Codeception\Maybe
  1326. */
  1327. public function fillField($field, $value) {
  1328. $this->scenario->addStep(new \Codeception\Step\Action('fillField', func_get_args()));
  1329. if ($this->scenario->running()) {
  1330. $result = $this->scenario->runStep();
  1331. return new Maybe($result);
  1332. }
  1333. return new Maybe();
  1334. }
  1335. /**
  1336. * This method is generated.
  1337. * Documentation taken from corresponding module.
  1338. * ----------------------------------------------
  1339. *
  1340. * Attaches file from Codeception data directory to upload field.
  1341. *
  1342. * Example:
  1343. *
  1344. * ``` php
  1345. * <?php
  1346. * // file is stored in 'tests/_data/prices.xls'
  1347. * $I->attachFile('input[@type="file"]', 'prices.xls');
  1348. * ?>
  1349. * ```
  1350. *
  1351. * @param $field
  1352. * @param $filename
  1353. * @see Codeception\Module\WebDriver::attachFile()
  1354. * @return \Codeception\Maybe
  1355. */
  1356. public function attachFile($field, $filename) {
  1357. $this->scenario->addStep(new \Codeception\Step\Action('attachFile', func_get_args()));
  1358. if ($this->scenario->running()) {
  1359. $result = $this->scenario->runStep();
  1360. return new Maybe($result);
  1361. }
  1362. return new Maybe();
  1363. }
  1364. /**
  1365. * This method is generated.
  1366. * Documentation taken from corresponding module.
  1367. * ----------------------------------------------
  1368. *
  1369. * Finds and returns text contents of element.
  1370. * Element is searched by CSS selector, XPath or matcher by regex.
  1371. *
  1372. * Example:
  1373. *
  1374. * ``` php
  1375. * <?php
  1376. * $heading = $I->grabTextFrom('h1');
  1377. * $heading = $I->grabTextFrom('descendant-or-self::h1');
  1378. * $value = $I->grabTextFrom('~<input value=(.*?)]~sgi');
  1379. * ?>
  1380. * ```
  1381. *
  1382. * @param $cssOrXPathOrRegex
  1383. * @return mixed
  1384. * @see Codeception\Module\WebDriver::grabTextFrom()
  1385. * @return \Codeception\Maybe
  1386. */
  1387. public function grabTextFrom($cssOrXPathOrRegex) {
  1388. $this->scenario->addStep(new \Codeception\Step\Action('grabTextFrom', func_get_args()));
  1389. if ($this->scenario->running()) {
  1390. $result = $this->scenario->runStep();
  1391. return new Maybe($result);
  1392. }
  1393. return new Maybe();
  1394. }
  1395. /**
  1396. * This method is generated.
  1397. * Documentation taken from corresponding module.
  1398. * ----------------------------------------------
  1399. *
  1400. * Finds and returns field and returns it's value.
  1401. * Searches by field name, then by CSS, then by XPath
  1402. *
  1403. * Example:
  1404. *
  1405. * ``` php
  1406. * <?php
  1407. * $name = $I->grabValueFrom('Name');
  1408. * $name = $I->grabValueFrom('input[name=username]');
  1409. * $name = $I->grabValueFrom('descendant-or-self::form/descendant::input[@name = 'username']');
  1410. * ?>
  1411. * ```
  1412. *
  1413. * @param $field
  1414. * @return mixed
  1415. * @see Codeception\Module\WebDriver::grabValueFrom()
  1416. * @return \Codeception\Maybe
  1417. */
  1418. public function grabValueFrom($field) {
  1419. $this->scenario->addStep(new \Codeception\Step\Action('grabValueFrom', func_get_args()));
  1420. if ($this->scenario->running()) {
  1421. $result = $this->scenario->runStep();
  1422. return new Maybe($result);
  1423. }
  1424. return new Maybe();
  1425. }
  1426. /**
  1427. * This method is generated.
  1428. * Documentation taken from corresponding module.
  1429. * ----------------------------------------------
  1430. *
  1431. * Checks for a visible element on a page, matching it by CSS or XPath
  1432. *
  1433. * ``` php
  1434. * <?php
  1435. * $I->seeElement('.error');
  1436. * $I->seeElement('//form/input[1]');
  1437. * ?>
  1438. * ```
  1439. * @param $selector
  1440. * Conditional Assertion: Test won't be stopped on fail
  1441. * @see Codeception\Module\WebDriver::seeElement()
  1442. * @return \Codeception\Maybe
  1443. */
  1444. public function canSeeElement($selector) {
  1445. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeElement', func_get_args()));
  1446. if ($this->scenario->running()) {
  1447. $result = $this->scenario->runStep();
  1448. return new Maybe($result);
  1449. }
  1450. return new Maybe();
  1451. }
  1452. /**
  1453. * This method is generated.
  1454. * Documentation taken from corresponding module.
  1455. * ----------------------------------------------
  1456. *
  1457. * Checks for a visible element on a page, matching it by CSS or XPath
  1458. *
  1459. * ``` php
  1460. * <?php
  1461. * $I->seeElement('.error');
  1462. * $I->seeElement('//form/input[1]');
  1463. * ?>
  1464. * ```
  1465. * @param $selector
  1466. * @see Codeception\Module\WebDriver::seeElement()
  1467. * @return \Codeception\Maybe
  1468. */
  1469. public function seeElement($selector) {
  1470. $this->scenario->addStep(new \Codeception\Step\Assertion('seeElement', func_get_args()));
  1471. if ($this->scenario->running()) {
  1472. $result = $this->scenario->runStep();
  1473. return new Maybe($result);
  1474. }
  1475. return new Maybe();
  1476. }
  1477. /**
  1478. * This method is generated.
  1479. * Documentation taken from corresponding module.
  1480. * ----------------------------------------------
  1481. *
  1482. * Checks that element is invisible or not present on page.
  1483. *
  1484. * ``` php
  1485. * <?php
  1486. * $I->dontSeeElement('.error');
  1487. * $I->dontSeeElement('//form/input[1]');
  1488. * ?>
  1489. * ```
  1490. *
  1491. * @param $selector
  1492. * Conditional Assertion: Test won't be stopped on fail
  1493. * @see Codeception\Module\WebDriver::dontSeeElement()
  1494. * @return \Codeception\Maybe
  1495. */
  1496. public function cantSeeElement($selector) {
  1497. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeElement', func_get_args()));
  1498. if ($this->scenario->running()) {
  1499. $result = $this->scenario->runStep();
  1500. return new Maybe($result);
  1501. }
  1502. return new Maybe();
  1503. }
  1504. /**
  1505. * This method is generated.
  1506. * Documentation taken from corresponding module.
  1507. * ----------------------------------------------
  1508. *
  1509. * Checks that element is invisible or not present on page.
  1510. *
  1511. * ``` php
  1512. * <?php
  1513. * $I->dontSeeElement('.error');
  1514. * $I->dontSeeElement('//form/input[1]');
  1515. * ?>
  1516. * ```
  1517. *
  1518. * @param $selector
  1519. * @see Codeception\Module\WebDriver::dontSeeElement()
  1520. * @return \Codeception\Maybe
  1521. */
  1522. public function dontSeeElement($selector) {
  1523. $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeElement', func_get_args()));
  1524. if ($this->scenario->running()) {
  1525. $result = $this->scenario->runStep();
  1526. return new Maybe($result);
  1527. }
  1528. return new Maybe();
  1529. }
  1530. /**
  1531. * This method is generated.
  1532. * Documentation taken from corresponding module.
  1533. * ----------------------------------------------
  1534. *
  1535. * Checks if element exists on a page even it is invisible.
  1536. *
  1537. * ``` php
  1538. * <?php
  1539. * $I->seeElementInDOM('//form/input[type=hidden]');
  1540. * ?>
  1541. * ```
  1542. *
  1543. * @param $selector
  1544. * Conditional Assertion: Test won't be stopped on fail
  1545. * @see Codeception\Module\WebDriver::seeElementInDOM()
  1546. * @return \Codeception\Maybe
  1547. */
  1548. public function canSeeElementInDOM($selector) {
  1549. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeElementInDOM', func_get_args()));
  1550. if ($this->scenario->running()) {
  1551. $result = $this->scenario->runStep();
  1552. return new Maybe($result);
  1553. }
  1554. return new Maybe();
  1555. }
  1556. /**
  1557. * This method is generated.
  1558. * Documentation taken from corresponding module.
  1559. * ----------------------------------------------
  1560. *
  1561. * Checks if element exists on a page even it is invisible.
  1562. *
  1563. * ``` php
  1564. * <?php
  1565. * $I->seeElementInDOM('//form/input[type=hidden]');
  1566. * ?>
  1567. * ```
  1568. *
  1569. * @param $selector
  1570. * @see Codeception\Module\WebDriver::seeElementInDOM()
  1571. * @return \Codeception\Maybe
  1572. */
  1573. public function seeElementInDOM($selector) {
  1574. $this->scenario->addStep(new \Codeception\Step\Assertion('seeElementInDOM', func_get_args()));
  1575. if ($this->scenario->running()) {
  1576. $result = $this->scenario->runStep();
  1577. return new Maybe($result);
  1578. }
  1579. return new Maybe();
  1580. }
  1581. /**
  1582. * This method is generated.
  1583. * Documentation taken from corresponding module.
  1584. * ----------------------------------------------
  1585. *
  1586. * Opposite to `seeElementInDOM`.
  1587. *
  1588. * @param $selector
  1589. * Conditional Assertion: Test won't be stopped on fail
  1590. * @see Codeception\Module\WebDriver::dontSeeElementInDOM()
  1591. * @return \Codeception\Maybe
  1592. */
  1593. public function cantSeeElementInDOM($selector) {
  1594. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeElementInDOM', func_get_args()));
  1595. if ($this->scenario->running()) {
  1596. $result = $this->scenario->runStep();
  1597. return new Maybe($result);
  1598. }
  1599. return new Maybe();
  1600. }
  1601. /**
  1602. * This method is generated.
  1603. * Documentation taken from corresponding module.
  1604. * ----------------------------------------------
  1605. *
  1606. * Opposite to `seeElementInDOM`.
  1607. *
  1608. * @param $selector
  1609. * @see Codeception\Module\WebDriver::dontSeeElementInDOM()
  1610. * @return \Codeception\Maybe
  1611. */
  1612. public function dontSeeElementInDOM($selector) {
  1613. $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeElementInDOM', func_get_args()));
  1614. if ($this->scenario->running()) {
  1615. $result = $this->scenario->runStep();
  1616. return new Maybe($result);
  1617. }
  1618. return new Maybe();
  1619. }
  1620. /**
  1621. * This method is generated.
  1622. * Documentation taken from corresponding module.
  1623. * ----------------------------------------------
  1624. *
  1625. * Checks if option is selected in select field.
  1626. *
  1627. * ``` php
  1628. * <?php
  1629. * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa');
  1630. * ?>
  1631. * ```
  1632. *
  1633. * @param $selector
  1634. * @param $optionText
  1635. * @return mixed
  1636. * Conditional Assertion: Test won't be stopped on fail
  1637. * @see Codeception\Module\WebDriver::seeOptionIsSelected()
  1638. * @return \Codeception\Maybe
  1639. */
  1640. public function canSeeOptionIsSelected($selector, $optionText) {
  1641. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeOptionIsSelected', func_get_args()));
  1642. if ($this->scenario->running()) {
  1643. $result = $this->scenario->runStep();
  1644. return new Maybe($result);
  1645. }
  1646. return new Maybe();
  1647. }
  1648. /**
  1649. * This method is generated.
  1650. * Documentation taken from corresponding module.
  1651. * ----------------------------------------------
  1652. *
  1653. * Checks if option is selected in select field.
  1654. *
  1655. * ``` php
  1656. * <?php
  1657. * $I->seeOptionIsSelected('#form input[name=payment]', 'Visa');
  1658. * ?>
  1659. * ```
  1660. *
  1661. * @param $selector
  1662. * @param $optionText
  1663. * @return mixed
  1664. * @see Codeception\Module\WebDriver::seeOptionIsSelected()
  1665. * @return \Codeception\Maybe
  1666. */
  1667. public function seeOptionIsSelected($selector, $optionText) {
  1668. $this->scenario->addStep(new \Codeception\Step\Assertion('seeOptionIsSelected', func_get_args()));
  1669. if ($this->scenario->running()) {
  1670. $result = $this->scenario->runStep();
  1671. return new Maybe($result);
  1672. }
  1673. return new Maybe();
  1674. }
  1675. /**
  1676. * This method is generated.
  1677. * Documentation taken from corresponding module.
  1678. * ----------------------------------------------
  1679. *
  1680. * Checks if option is not selected in select field.
  1681. *
  1682. * ``` php
  1683. * <?php
  1684. * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
  1685. * ?>
  1686. * ```
  1687. *
  1688. * @param $selector
  1689. * @param $optionText
  1690. * @return mixed
  1691. * Conditional Assertion: Test won't be stopped on fail
  1692. * @see Codeception\Module\WebDriver::dontSeeOptionIsSelected()
  1693. * @return \Codeception\Maybe
  1694. */
  1695. public function cantSeeOptionIsSelected($selector, $optionText) {
  1696. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeOptionIsSelected', func_get_args()));
  1697. if ($this->scenario->running()) {
  1698. $result = $this->scenario->runStep();
  1699. return new Maybe($result);
  1700. }
  1701. return new Maybe();
  1702. }
  1703. /**
  1704. * This method is generated.
  1705. * Documentation taken from corresponding module.
  1706. * ----------------------------------------------
  1707. *
  1708. * Checks if option is not selected in select field.
  1709. *
  1710. * ``` php
  1711. * <?php
  1712. * $I->dontSeeOptionIsSelected('#form input[name=payment]', 'Visa');
  1713. * ?>
  1714. * ```
  1715. *
  1716. * @param $selector
  1717. * @param $optionText
  1718. * @return mixed
  1719. * @see Codeception\Module\WebDriver::dontSeeOptionIsSelected()
  1720. * @return \Codeception\Maybe
  1721. */
  1722. public function dontSeeOptionIsSelected($selector, $optionText) {
  1723. $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeOptionIsSelected', func_get_args()));
  1724. if ($this->scenario->running()) {
  1725. $result = $this->scenario->runStep();
  1726. return new Maybe($result);
  1727. }
  1728. return new Maybe();
  1729. }
  1730. /**
  1731. * This method is generated.
  1732. * Documentation taken from corresponding module.
  1733. * ----------------------------------------------
  1734. *
  1735. * Checks that page title contains text.
  1736. *
  1737. * ``` php
  1738. * <?php
  1739. * $I->seeInTitle('Blog - Post #1');
  1740. * ?>
  1741. * ```
  1742. *
  1743. * @param $title
  1744. * @return mixed
  1745. * Conditional Assertion: Test won't be stopped on fail
  1746. * @see Codeception\Module\WebDriver::seeInTitle()
  1747. * @return \Codeception\Maybe
  1748. */
  1749. public function canSeeInTitle($title) {
  1750. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInTitle', func_get_args()));
  1751. if ($this->scenario->running()) {
  1752. $result = $this->scenario->runStep();
  1753. return new Maybe($result);
  1754. }
  1755. return new Maybe();
  1756. }
  1757. /**
  1758. * This method is generated.
  1759. * Documentation taken from corresponding module.
  1760. * ----------------------------------------------
  1761. *
  1762. * Checks that page title contains text.
  1763. *
  1764. * ``` php
  1765. * <?php
  1766. * $I->seeInTitle('Blog - Post #1');
  1767. * ?>
  1768. * ```
  1769. *
  1770. * @param $title
  1771. * @return mixed
  1772. * @see Codeception\Module\WebDriver::seeInTitle()
  1773. * @return \Codeception\Maybe
  1774. */
  1775. public function seeInTitle($title) {
  1776. $this->scenario->addStep(new \Codeception\Step\Assertion('seeInTitle', func_get_args()));
  1777. if ($this->scenario->running()) {
  1778. $result = $this->scenario->runStep();
  1779. return new Maybe($result);
  1780. }
  1781. return new Maybe();
  1782. }
  1783. /**
  1784. * This method is generated.
  1785. * Documentation taken from corresponding module.
  1786. * ----------------------------------------------
  1787. *
  1788. * Checks that page title does not contain text.
  1789. *
  1790. * @param $title
  1791. * @return mixed
  1792. * Conditional Assertion: Test won't be stopped on fail
  1793. * @see Codeception\Module\WebDriver::dontSeeInTitle()
  1794. * @return \Codeception\Maybe
  1795. */
  1796. public function cantSeeInTitle($title) {
  1797. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('dontSeeInTitle', func_get_args()));
  1798. if ($this->scenario->running()) {
  1799. $result = $this->scenario->runStep();
  1800. return new Maybe($result);
  1801. }
  1802. return new Maybe();
  1803. }
  1804. /**
  1805. * This method is generated.
  1806. * Documentation taken from corresponding module.
  1807. * ----------------------------------------------
  1808. *
  1809. * Checks that page title does not contain text.
  1810. *
  1811. * @param $title
  1812. * @return mixed
  1813. * @see Codeception\Module\WebDriver::dontSeeInTitle()
  1814. * @return \Codeception\Maybe
  1815. */
  1816. public function dontSeeInTitle($title) {
  1817. $this->scenario->addStep(new \Codeception\Step\Assertion('dontSeeInTitle', func_get_args()));
  1818. if ($this->scenario->running()) {
  1819. $result = $this->scenario->runStep();
  1820. return new Maybe($result);
  1821. }
  1822. return new Maybe();
  1823. }
  1824. /**
  1825. * This method is generated.
  1826. * Documentation taken from corresponding module.
  1827. * ----------------------------------------------
  1828. *
  1829. * Accepts JavaScript native popup window created by `window.alert`|`window.confirm`|`window.prompt`.
  1830. * Don't confuse it with modal windows, created by [various libraries](http://jster.net/category/windows-modals-popups).
  1831. *
  1832. * @see Codeception\Module\WebDriver::acceptPopup()
  1833. * @return \Codeception\Maybe
  1834. */
  1835. public function acceptPopup() {
  1836. $this->scenario->addStep(new \Codeception\Step\Action('acceptPopup', func_get_args()));
  1837. if ($this->scenario->running()) {
  1838. $result = $this->scenario->runStep();
  1839. return new Maybe($result);
  1840. }
  1841. return new Maybe();
  1842. }
  1843. /**
  1844. * This method is generated.
  1845. * Documentation taken from corresponding module.
  1846. * ----------------------------------------------
  1847. *
  1848. * Dismisses active JavaScript popup created by `window.alert`|`window.confirm`|`window.prompt`.
  1849. * @see Codeception\Module\WebDriver::cancelPopup()
  1850. * @return \Codeception\Maybe
  1851. */
  1852. public function cancelPopup() {
  1853. $this->scenario->addStep(new \Codeception\Step\Action('cancelPopup', func_get_args()));
  1854. if ($this->scenario->running()) {
  1855. $result = $this->scenario->runStep();
  1856. return new Maybe($result);
  1857. }
  1858. return new Maybe();
  1859. }
  1860. /**
  1861. * This method is generated.
  1862. * Documentation taken from corresponding module.
  1863. * ----------------------------------------------
  1864. *
  1865. * Checks that active JavaScript popup created by `window.alert`|`window.confirm`|`window.prompt` contain text.
  1866. *
  1867. * @param $text
  1868. * Conditional Assertion: Test won't be stopped on fail
  1869. * @see Codeception\Module\WebDriver::seeInPopup()
  1870. * @return \Codeception\Maybe
  1871. */
  1872. public function canSeeInPopup($text) {
  1873. $this->scenario->addStep(new \Codeception\Step\ConditionalAssertion('seeInPopup', func_get_args()));
  1874. if ($this->scenario->running()) {
  1875. $result = $this->scenario->runStep();
  1876. return new Maybe($result);
  1877. }
  1878. return new Maybe();
  1879. }
  1880. /**
  1881. * This method is generated.
  1882. * Documentation taken from corresponding module.
  1883. * ----------------------------------------------
  1884. *
  1885. * Checks that active JavaScript popup created by `window.alert`|`window.confirm`|`window.prompt` contain text.
  1886. *
  1887. * @param $text
  1888. * @see Codeception\Module\WebDriver::seeInPopup()
  1889. * @return \Codeception\Maybe
  1890. */
  1891. public function seeInPopup($text) {
  1892. $this->scenario->addStep(new \Codeception\Step\Assertion('seeInPopup', func_get_args()));
  1893. if ($this->scenario->running()) {
  1894. $result = $this->scenario->runStep();
  1895. return new Maybe($result);
  1896. }
  1897. return new Maybe();
  1898. }
  1899. /**
  1900. * This method is generated.
  1901. * Documentation taken from corresponding module.
  1902. * ----------------------------------------------
  1903. *
  1904. * Enters text into native JavaScript prompt popup created by `window.prompt`.
  1905. *
  1906. * @param $keys
  1907. * @see Codeception\Module\WebDriver::typeInPopup()
  1908. * @return \Codeception\Maybe
  1909. */
  1910. public function typeInPopup($keys) {
  1911. $this->scenario->addStep(new \Codeception\Step\Action('typeInPopup', func_get_args()));
  1912. if ($this->scenario->running()) {
  1913. $result = $this->scenario->runStep();
  1914. return new Maybe($result);
  1915. }
  1916. return new Maybe();
  1917. }
  1918. /**
  1919. * This method is generated.
  1920. * Documentation taken from corresponding module.
  1921. * ----------------------------------------------
  1922. *
  1923. * Reloads current page
  1924. * @see Codeception\Module\WebDriver::reloadPage()
  1925. * @return \Codeception\Maybe
  1926. */
  1927. public function reloadPage() {
  1928. $this->scenario->addStep(new \Codeception\Step\Action('reloadPage', func_get_args()));
  1929. if ($this->scenario->running()) {
  1930. $result = $this->scenario->runStep();
  1931. return new Maybe($result);
  1932. }
  1933. return new Maybe();
  1934. }
  1935. /**
  1936. * This method is generated.
  1937. * Documentation taken from corresponding module.
  1938. * ----------------------------------------------
  1939. *
  1940. * Moves back in history
  1941. * @see Codeception\Module\WebDriver::moveBack()
  1942. * @return \Codeception\Maybe
  1943. */
  1944. public function moveBack() {
  1945. $this->scenario->addStep(new \Codeception\Step\Action('moveBack', func_get_args()));
  1946. if ($this->scenario->running()) {
  1947. $result = $this->scenario->runStep();
  1948. return new Maybe($result);
  1949. }
  1950. return new Maybe();
  1951. }
  1952. /**
  1953. * This method is generated.
  1954. * Documentation taken from corresponding module.
  1955. * ----------------------------------------------
  1956. *
  1957. * Moves forward in history
  1958. * @see Codeception\Module\WebDriver::moveForward()
  1959. * @return \Codeception\Maybe
  1960. */
  1961. public function moveForward() {
  1962. $this->scenario->addStep(new \Codeception\Step\Action('moveForward', func_get_args()));
  1963. if ($this->scenario->running()) {
  1964. $result = $this->scenario->runStep();
  1965. return new Maybe($result);
  1966. }
  1967. return new Maybe();
  1968. }
  1969. /**
  1970. * This method is generated.
  1971. * Documentation taken from corresponding module.
  1972. * ----------------------------------------------
  1973. *
  1974. * Submits a form located on page.
  1975. * Specify the form by it's css or xpath selector.
  1976. * Fill the form fields values as array. Hidden fields can't be accessed.
  1977. *
  1978. * This command itself triggers the request to form's action.
  1979. *
  1980. * Examples:
  1981. *
  1982. * ``` php
  1983. * <?php
  1984. * $I->submitForm('#login', array('login' => 'davert', 'password' => '123456'));
  1985. *
  1986. * ```
  1987. *
  1988. * For sample Sign Up form:
  1989. *
  1990. * ``` html
  1991. * <form action="/sign_up">
  1992. * Login: <input type="text" name="user[login]" /><br/>
  1993. * Password: <input type="password" name="user[password]" /><br/>
  1994. * Do you agree to out terms? <input type="checkbox" name="user[agree]" /><br/>
  1995. * Select pricing plan <select name="plan"><option value="1">Free</option><option value="2" selected="selected">Paid</option></select>
  1996. * <input type="submit" value="Submit" />
  1997. * </form>
  1998. * ```
  1999. * You can write this:
  2000. *
  2001. * ``` php
  2002. * <?php
  2003. * $I->submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true)));
  2004. *
  2005. * ```
  2006. *
  2007. * @param $selector
  2008. * @param $params
  2009. * @throws \Codeception\Exception\ElementNotFound
  2010. * @see Codeception\Module\WebDriver::submitForm()
  2011. * @return \Codeception\Maybe
  2012. */
  2013. public function submitForm($selector, $params) {
  2014. $this->scenario->addStep(new \Codeception\Step\Action('submitForm', func_get_args()));
  2015. if ($this->scenario->running()) {
  2016. $result = $this->scenario->runStep();
  2017. return new Maybe($result);
  2018. }
  2019. return new Maybe();
  2020. }
  2021. /**
  2022. * This method is generated.
  2023. * Documentation taken from corresponding module.
  2024. * ----------------------------------------------
  2025. *
  2026. * Waits until element has changed according to callback function or for $time seconds to pass.
  2027. *
  2028. * ``` php
  2029. * <?php
  2030. * $I->waitForElementChange('#menu', function(\WebDriverElement $el) {
  2031. * return $el->isDisplayed();
  2032. * }, 100);
  2033. * ?>
  2034. * ```
  2035. *
  2036. * @param $element
  2037. * @param \Closure $callback
  2038. * @param int $timeout seconds
  2039. * @throws \Codeception\Exception\ElementNotFound
  2040. * @see Codeception\Module\WebDriver::waitForElementChange()
  2041. * @return \Codeception\Maybe
  2042. */
  2043. public function waitForElementChange($element, $callback, $timeout = null) {
  2044. $this->scenario->addStep(new \Codeception\Step\Action('waitForElementChange', func_get_args()));
  2045. if ($this->scenario->running()) {
  2046. $result = $this->scenario->runStep();
  2047. return new Maybe($result);
  2048. }
  2049. return new Maybe();
  2050. }
  2051. /**
  2052. * This method is generated.
  2053. * Documentation taken from corresponding module.
  2054. * ----------------------------------------------
  2055. *
  2056. * Waits for element to appear on page for $timeout seconds to pass.
  2057. * If element not appears, timeout exception is thrown.
  2058. *
  2059. * ``` php
  2060. * <?php
  2061. * $I->waitForElement('#agree_button', 30); // secs
  2062. * $I->click('#agree_button');
  2063. * ?>
  2064. * ```
  2065. *
  2066. * @param $element
  2067. * @param int $timeout seconds
  2068. * @throws \Exception
  2069. * @see Codeception\Module\WebDriver::waitForElement()
  2070. * @return \Codeception\Maybe
  2071. */
  2072. public function waitForElement($element, $timeout = null) {
  2073. $this->scenario->addStep(new \Codeception\Step\Action('waitForElement', func_get_args()));
  2074. if ($this->scenario->running()) {
  2075. $result = $this->scenario->runStep();
  2076. return new Maybe($result);
  2077. }
  2078. return new Maybe();
  2079. }
  2080. /**
  2081. * This method is generated.
  2082. * Documentation taken from corresponding module.
  2083. * ----------------------------------------------
  2084. *
  2085. * Waits for element to be visible on the page for $timeout seconds to pass.
  2086. * If element doesn't appear, timeout exception is thrown.
  2087. *
  2088. * ``` php
  2089. * <?php
  2090. * $I->waitForElementVisible('#agree_button', 30); // secs
  2091. * $I->click('#agree_button');
  2092. * ?>
  2093. * ```
  2094. *
  2095. * @param $element
  2096. * @param int $timeout seconds
  2097. * @throws \Exception
  2098. * @see Codeception\Module\WebDriver::waitForElementVisible()
  2099. * @return \Codeception\Maybe
  2100. */
  2101. public function waitForElementVisible($element, $timeout = null) {
  2102. $this->scenario->addStep(new \Codeception\Step\Action('waitForElementVisible', func_get_args()));
  2103. if ($this->scenario->running()) {
  2104. $result = $this->scenario->runStep();
  2105. return new Maybe($result);
  2106. }
  2107. return new Maybe();
  2108. }
  2109. /**
  2110. * This method is generated.
  2111. * Documentation taken from corresponding module.
  2112. * ----------------------------------------------
  2113. *
  2114. * Waits for element to not be visible on the page for $timeout seconds to pass.
  2115. * If element stays visible, timeout exception is thrown.
  2116. *
  2117. * ``` php
  2118. * <?php
  2119. * $I->waitForElementNotVisible('#agree_button', 30); // secs
  2120. * ?>
  2121. * ```
  2122. *
  2123. * @param $element
  2124. * @param int $timeout seconds
  2125. * @throws \Exception
  2126. * @see Codeception\Module\WebDriver::waitForElementNotVisible()
  2127. * @return \Codeception\Maybe
  2128. */
  2129. public function waitForElementNotVisible($element, $timeout = null) {
  2130. $this->scenario->addStep(new \Codeception\Step\Action('waitForElementNotVisible', func_get_args()));
  2131. if ($this->scenario->running()) {
  2132. $result = $this->scenario->runStep();
  2133. return new Maybe($result);
  2134. }
  2135. return new Maybe();
  2136. }
  2137. /**
  2138. * This method is generated.
  2139. * Documentation taken from corresponding module.
  2140. * ----------------------------------------------
  2141. *
  2142. * Waits for text to appear on the page for a specific amount of time.
  2143. * Can also be passed a selector to search in.
  2144. * If text does not appear, timeout exception is thrown.
  2145. *
  2146. * ``` php
  2147. * <?php
  2148. * $I->waitForText('foo', 30); // secs
  2149. * $I->waitForText('foo', 30, '.title'); // secs
  2150. * ?>
  2151. * ```
  2152. *
  2153. * @param string $text
  2154. * @param int $timeout seconds
  2155. * @param null $selector
  2156. * @throws \Exception
  2157. * @internal param string $element
  2158. * @see Codeception\Module\WebDriver::waitForText()
  2159. * @return \Codeception\Maybe
  2160. */
  2161. public function waitForText($text, $timeout = null, $selector = null) {
  2162. $this->scenario->addStep(new \Codeception\Step\Action('waitForText', func_get_args()));
  2163. if ($this->scenario->running()) {
  2164. $result = $this->scenario->runStep();
  2165. return new Maybe($result);
  2166. }
  2167. return new Maybe();
  2168. }
  2169. /**
  2170. * This method is generated.
  2171. * Documentation taken from corresponding module.
  2172. * ----------------------------------------------
  2173. *
  2174. * Explicit wait.
  2175. *
  2176. * @param $timeout secs
  2177. * @see Codeception\Module\WebDriver::wait()
  2178. * @return \Codeception\Maybe
  2179. */
  2180. public function wait($timeout) {
  2181. $this->scenario->addStep(new \Codeception\Step\Action('wait', func_get_args()));
  2182. if ($this->scenario->running()) {
  2183. $result = $this->scenario->runStep();
  2184. return new Maybe($result);
  2185. }
  2186. return new Maybe();
  2187. }
  2188. /**
  2189. * This method is generated.
  2190. * Documentation taken from corresponding module.
  2191. * ----------------------------------------------
  2192. *
  2193. * Low-level API method.
  2194. * If Codeception commands are not enough, use Selenium WebDriver methods directly
  2195. *
  2196. * ``` php
  2197. * $I->executeInSelenium(function(\WebDriver $webdriver) {
  2198. * $webdriver->get('http://google.com');
  2199. * });
  2200. * ```
  2201. *
  2202. * Use [WebDriver Session API](https://github.com/facebook/php-webdriver)
  2203. * Not recommended this command too be used on regular basis.
  2204. * If Codeception lacks important Selenium methods implement then and submit patches.
  2205. *
  2206. * @param callable $function
  2207. * @see Codeception\Module\WebDriver::executeInSelenium()
  2208. * @return \Codeception\Maybe
  2209. */
  2210. public function executeInSelenium($function) {
  2211. $this->scenario->addStep(new \Codeception\Step\Action('executeInSelenium', func_get_args()));
  2212. if ($this->scenario->running()) {
  2213. $result = $this->scenario->runStep();
  2214. return new Maybe($result);
  2215. }
  2216. return new Maybe();
  2217. }
  2218. /**
  2219. * This method is generated.
  2220. * Documentation taken from corresponding module.
  2221. * ----------------------------------------------
  2222. *
  2223. * Switch to another window identified by its name.
  2224. *
  2225. * The window can only be identified by its name. If the $name parameter is blank it will switch to the parent window.
  2226. *
  2227. * Example:
  2228. * ``` html
  2229. * <input type="button" value="Open window" onclick="window.open('http://example.com', 'another_window')">
  2230. * ```
  2231. *
  2232. * ``` php
  2233. * <?php
  2234. * $I->click("Open window");
  2235. * # switch to another window
  2236. * $I->switchToWindow("another_window");
  2237. * # switch to parent window
  2238. * $I->switchToWindow();
  2239. * ?>
  2240. * ```
  2241. *
  2242. * If the window has no name, the only way to access it is via the `executeInSelenium()` method like so:
  2243. *
  2244. * ```
  2245. * <?php
  2246. * $I->executeInSelenium(function (\Webdriver $webdriver) {
  2247. * $handles=$webDriver->getWindowHandles();
  2248. * $last_window = end($handles);
  2249. * $webDriver->switchTo()->window($name);
  2250. * });
  2251. * ?>
  2252. * ```
  2253. *
  2254. * @param string|null $name
  2255. * @see Codeception\Module\WebDriver::switchToWindow()
  2256. * @return \Codeception\Maybe
  2257. */
  2258. public function switchToWindow($name = null) {
  2259. $this->scenario->addStep(new \Codeception\Step\Action('switchToWindow', func_get_args()));
  2260. if ($this->scenario->running()) {
  2261. $result = $this->scenario->runStep();
  2262. return new Maybe($result);
  2263. }
  2264. return new Maybe();
  2265. }
  2266. /**
  2267. * This method is generated.
  2268. * Documentation taken from corresponding module.
  2269. * ----------------------------------------------
  2270. *
  2271. * Switch to another frame
  2272. *
  2273. * Example:
  2274. * ``` html
  2275. * <iframe name="another_frame" src="http://example.com">
  2276. *
  2277. * ```
  2278. *
  2279. * ``` php
  2280. * <?php
  2281. * # switch to iframe
  2282. * $I->switchToIFrame("another_frame");
  2283. * # switch to parent page
  2284. * $I->switchToIFrame();
  2285. *
  2286. * ```
  2287. *
  2288. * @param string|null $name
  2289. * @see Codeception\Module\WebDriver::switchToIFrame()
  2290. * @return \Codeception\Maybe
  2291. */
  2292. public function switchToIFrame($name = null) {
  2293. $this->scenario->addStep(new \Codeception\Step\Action('switchToIFrame', func_get_args()));
  2294. if ($this->scenario->running()) {
  2295. $result = $this->scenario->runStep();
  2296. return new Maybe($result);
  2297. }
  2298. return new Maybe();
  2299. }
  2300. /**
  2301. * This method is generated.
  2302. * Documentation taken from corresponding module.
  2303. * ----------------------------------------------
  2304. *
  2305. * Executes JavaScript and waits for it to return true or for the timeout.
  2306. *
  2307. * In this example we will wait for all jQuery ajax requests are finished or 60 secs otherwise.
  2308. *
  2309. * ``` php
  2310. * <?php
  2311. * $I->waitForJS("return $.active == 0;", 60);
  2312. * ?>
  2313. * ```
  2314. *
  2315. * @param $script
  2316. * @param $timeout int seconds
  2317. * @see Codeception\Module\WebDriver::waitForJS()
  2318. * @return \Codeception\Maybe
  2319. */
  2320. public function waitForJS($script, $timeout = null) {
  2321. $this->scenario->addStep(new \Codeception\Step\Action('waitForJS', func_get_args()));
  2322. if ($this->scenario->running()) {
  2323. $result = $this->scenario->runStep();
  2324. return new Maybe($result);
  2325. }
  2326. return new Maybe();
  2327. }
  2328. /**
  2329. * This method is generated.
  2330. * Documentation taken from corresponding module.
  2331. * ----------------------------------------------
  2332. *
  2333. * Executes custom JavaScript
  2334. *
  2335. * @param $script
  2336. * @return mixed
  2337. * @see Codeception\Module\WebDriver::executeJS()
  2338. * @return \Codeception\Maybe
  2339. */
  2340. public function executeJS($script) {
  2341. $this->scenario->addStep(new \Codeception\Step\Action('executeJS', func_get_args()));
  2342. if ($this->scenario->running()) {
  2343. $result = $this->scenario->runStep();
  2344. return new Maybe($result);
  2345. }
  2346. return new Maybe();
  2347. }
  2348. /**
  2349. * This method is generated.
  2350. * Documentation taken from corresponding module.
  2351. * ----------------------------------------------
  2352. *
  2353. * Maximizes current window
  2354. * @see Codeception\Module\WebDriver::maximizeWindow()
  2355. * @return \Codeception\Maybe
  2356. */
  2357. public function maximizeWindow() {
  2358. $this->scenario->addStep(new \Codeception\Step\Action('maximizeWindow', func_get_args()));
  2359. if ($this->scenario->running()) {
  2360. $result = $this->scenario->runStep();
  2361. return new Maybe($result);
  2362. }
  2363. return new Maybe();
  2364. }
  2365. /**
  2366. * This method is generated.
  2367. * Documentation taken from corresponding module.
  2368. * ----------------------------------------------
  2369. *
  2370. * Performs a simple mouse drag and drop operation.
  2371. *
  2372. * ``` php
  2373. * <?php
  2374. * $I->dragAndDrop('#drag', '#drop');
  2375. * ?>
  2376. * ```
  2377. *
  2378. * @param string $source (CSS ID or XPath)
  2379. * @param string $target (CSS ID or XPath)
  2380. * @see Codeception\Module\WebDriver::dragAndDrop()
  2381. * @return \Codeception\Maybe
  2382. */
  2383. public function dragAndDrop($source, $target) {
  2384. $this->scenario->addStep(new \Codeception\Step\Action('dragAndDrop', func_get_args()));
  2385. if ($this->scenario->running()) {
  2386. $result = $this->scenario->runStep();
  2387. return new Maybe($result);
  2388. }
  2389. return new Maybe();
  2390. }
  2391. /**
  2392. * This method is generated.
  2393. * Documentation taken from corresponding module.
  2394. * ----------------------------------------------
  2395. *
  2396. * Move mouse over the first element matched by css or xPath on page
  2397. *
  2398. * https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/moveto
  2399. *
  2400. * @param string $cssOrXPath css or xpath of the web element
  2401. * @param int $offsetX
  2402. * @param int $offsetY
  2403. *
  2404. * @throws \Codeception\Exception\ElementNotFound
  2405. * @return null
  2406. * @see Codeception\Module\WebDriver::moveMouseOver()
  2407. * @return \Codeception\Maybe
  2408. */
  2409. public function moveMouseOver($cssOrXPath, $offsetX = null, $offsetY = null) {
  2410. $this->scenario->addStep(new \Codeception\Step\Action('moveMouseOver', func_get_args()));
  2411. if ($this->scenario->running()) {
  2412. $result = $this->scenario->runStep();
  2413. return new Maybe($result);
  2414. }
  2415. return new Maybe();
  2416. }
  2417. /**
  2418. * This method is generated.
  2419. * Documentation taken from corresponding module.
  2420. * ----------------------------------------------
  2421. *
  2422. * Performs contextual click with right mouse button on element matched by CSS or XPath.
  2423. *
  2424. * @param $cssOrXPath
  2425. * @throws \Codeception\Exception\ElementNotFound
  2426. * @see Codeception\Module\WebDriver::clickWithRightButton()
  2427. * @return \Codeception\Maybe
  2428. */
  2429. public function clickWithRightButton($cssOrXPath) {
  2430. $this->scenario->addStep(new \Codeception\Step\Action('clickWithRightButton', func_get_args()));
  2431. if ($this->scenario->running()) {
  2432. $result = $this->scenario->runStep();
  2433. return new Maybe($result);
  2434. }
  2435. return new Maybe();
  2436. }
  2437. /**
  2438. * This method is generated.
  2439. * Documentation taken from corresponding module.
  2440. * ----------------------------------------------
  2441. *
  2442. * Pauses test execution in debug mode.
  2443. * To proceed test press "ENTER" in console.
  2444. *
  2445. * This method is recommended to use in test development, for additional page analysis, locator searing, etc.
  2446. * @see Codeception\Module\WebDriver::pauseExecution()
  2447. * @return \Codeception\Maybe
  2448. */
  2449. public function pauseExecution() {
  2450. $this->scenario->addStep(new \Codeception\Step\Action('pauseExecution', func_get_args()));
  2451. if ($this->scenario->running()) {
  2452. $result = $this->scenario->runStep();
  2453. return new Maybe($result);
  2454. }
  2455. return new Maybe();
  2456. }
  2457. /**
  2458. * This method is generated.
  2459. * Documentation taken from corresponding module.
  2460. * ----------------------------------------------
  2461. *
  2462. * Performs a double click on element matched by CSS or XPath.
  2463. *
  2464. * @param $cssOrXPath
  2465. * @throws \Codeception\Exception\ElementNotFound
  2466. * @see Codeception\Module\WebDriver::doubleClick()
  2467. * @return \Codeception\Maybe
  2468. */
  2469. public function doubleClick($cssOrXPath) {
  2470. $this->scenario->addStep(new \Codeception\Step\Action('doubleClick', func_get_args()));
  2471. if ($this->scenario->running()) {
  2472. $result = $this->scenario->runStep();
  2473. return new Maybe($result);
  2474. }
  2475. return new Maybe();
  2476. }
  2477. /**
  2478. * This method is generated.
  2479. * Documentation taken from corresponding module.
  2480. * ----------------------------------------------
  2481. *
  2482. * Presses key on element found by css, xpath is focused
  2483. * A char and modifier (ctrl, alt, shift, meta) can be provided.
  2484. * For special keys use key constants from \WebDriverKeys class.
  2485. *
  2486. * Example:
  2487. *
  2488. * ``` php
  2489. * <?php
  2490. * // <input id="page" value="old" />
  2491. * $I->pressKey('#page','a'); // => olda
  2492. * $I->pressKey('#page',array('ctrl','a'),'new'); //=> new
  2493. * $I->pressKey('#page',array('shift','111'),'1','x'); //=> old!!!1x
  2494. * $I->pressKey('descendant-or-self::*[@id='page']','u'); //=> oldu
  2495. * $I->pressKey('#name', array('ctrl', 'a'), WebDriverKeys::DELETE); //=>''
  2496. * ?>
  2497. * ```
  2498. *
  2499. * @param $element
  2500. * @param $char can be char or array with modifier. You can provide several chars.
  2501. * @throws \Codeception\Exception\ElementNotFound
  2502. * @see Codeception\Module\WebDriver::pressKey()
  2503. * @return \Codeception\Maybe
  2504. */
  2505. public function pressKey($element, $char) {
  2506. $this->scenario->addStep(new \Codeception\Step\Action('pressKey', func_get_args()));
  2507. if ($this->scenario->running()) {
  2508. $result = $this->scenario->runStep();
  2509. return new Maybe($result);
  2510. }
  2511. return new Maybe();
  2512. }
  2513. /**
  2514. * This method is generated.
  2515. * Documentation taken from corresponding module.
  2516. * ----------------------------------------------
  2517. *
  2518. * Append text to an element
  2519. * Can add another selection to a select box
  2520. *
  2521. * ``` php
  2522. * <?php
  2523. * $I->appendField('#mySelectbox', 'SelectValue');
  2524. * $I->appendField('#myTextField', 'appended');
  2525. * ?>
  2526. * ```
  2527. *
  2528. * @param string $field
  2529. * @param string $value
  2530. * @see Codeception\Module\WebDriver::appendField()
  2531. * @return \Codeception\Maybe
  2532. */
  2533. public function appendField($field, $value) {
  2534. $this->scenario->addStep(new \Codeception\Step\Action('appendField', func_get_args()));
  2535. if ($this->scenario->running()) {
  2536. $result = $this->scenario->runStep();
  2537. return new Maybe($result);
  2538. }
  2539. return new Maybe();
  2540. }
  2541. }