php - How to get the current Browser in a Selenium RC Test? -



php - How to get the current Browser in a Selenium RC Test? -

i'm coming problem still can't solve after hours of hard googling : lastly chance...

i have simple php page (let's "bad_request.php") respond 400 bad request status code :

<?php header('status: 400 bad request', false, 400); header($_server['server_protocol'].' 400 bad request', false, 400); exit('error message'); ?>

i have selenium rc test case defined set of browsers :

static public $browsers = array( array( 'name' => 'google chrome 12 on win7', 'browser' => '*googlechrome' ), array( 'name' => 'internet explorer 9 on win7', 'browser' => '*iehta' ), ... )

and have test method opens "bad_request.php" , check status code , error message.

the thing browsers don't have same behaviour 400 status code : net explorer displays own error page (and doesn't show "error message" sent exit function) , other browsers display simple blank page "error message".

this why test method :

public function testbadrequest() { $this->open('bad_request.php'); /* * test status code own method */ $this->assertstatuscode(400); /* * test page content */ // case of net explorer if (preg_match('`^internet explorer`', $this->browsername )) { $this->asserttextpresent('http 400'); } // case of other browser else { $this->asserttextpresent('error message'); } }

sadly, browsername null , didn't find solution current browser in test method.

does here have solution ?

in c# (different php question, may help comes across question did), used driver.capabilities.browsername driver openqa.selenium.remote.remotewebdriver of current test run.

php browser selenium-rc

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -