Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I found how to by writing a log file when an error accurs and i created a Cron to send an email by checking if the file exists or not</p> <p>This is my code : </p> <pre><code>&lt;?php class Example extends PHPUnit_Extensions_SeleniumTestCase { protected function setUp() { $this-&gt;setBrowser("*firefox"); $this-&gt;setBrowserUrl("http://recette2011.thalys.com/"); $this-&gt;setSpeed(500); } public function testMyTestCase() { $this-&gt;open("/be/en"); $this-&gt;click("link=Help"); $this-&gt;waitForPageToLoad("30000"); $this-&gt;click("id=multi_block_title_span_element_2"); $this-&gt;click("id=demande_information"); $this-&gt;click("id=type_billet_information_aucun"); $this-&gt;click("id=btn_valider"); $this-&gt;waitForPageToLoad("30000"); $url = $this-&gt;getLocation(); echo $url; $cpt = substr_count ($url, "&amp;"); if($cpt &gt;3){ $date = date("d-m-Y"); $heure = date("H:i"); $monfichier = fopen('C:\Users\intégrateur\Desktop\testSelenium\logSelenium.txt', 'a+'); fputs($monfichier, '-- Probleme dans le fichier PasBillet.php le '.$date.' a '.$heure.' -- '); fclose($monfichier); } else { echo "Test Granted"; } } } ?&gt; </code></pre> <p>And the Cron is : </p> <pre><code>&lt;?php $file = "C:\Users\intégrateur\Desktop\testSelenium\logSelenium.txt"; if(file_exists($file)) { if(filesize($file)&gt;0) { mail('ths@bytesandcom.be','Probleme selenium','Une erreur est survenue dans un test de formaulaire. Pour plus d\'info consulter le fichier logSelenium.txt'); } } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload