AcceptanceTesterActions.php 99 KB

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