AcceptanceTesterActions.php 91 KB

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