AcceptanceTesterActions.php 99 KB

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