I have problem to reuse selenium session object in 2 function of my code. how can i do that? first function called and it's show the result. then second function called from html post method. how can run selenium in second function with first function session? thanks
$webdriver = new WebDriver("localhost", "4444");
$webdriver->connect("firefox");
$webdriver->get("http://AAA.AAA");
//here with some method i store picture of captcha to show
echo '<form method="post" action="process.php">
<table class="table">
<tr>
<td>Enter value of picture
<img src="thumb.jpeg">
</td>
<td>
<input type="text" name="captcha" dir="ltr">
</td>
</tr>
<tr>
<td colspan="2">
<button class="submit">Send</button>
</td>
</tr>
</table>
</form>';
And process.php it's like this ( second function )
$webdriver->findElementBy("id","username")->sendKeys("XXX");
$webdriver->findElementBy("id","password")->sendKeys("YYYY");
$webdriver->findElementBy("id","captcha")->sendKeys($_POST['captcha']);
$webdriver->findElementBy("id","submit")->click();
but $webdriver in second function is not defined, and it must have same session id with $webdriver in first function How Can I Do That?
process.phpcheck value of the POST var value.