Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to execute javascript using PHPunit Selenium

I am trying to execute a javascript code using PHPUnit Command. It executes the PHP code and sends email and other stuffs.

But there is some javascript code inside that php file that sends some data to third party url. That seems to be not working.

Any thoughts as how to execute the javascript code?

like image 705
chandresh_cool Avatar asked Aug 04 '26 16:08

chandresh_cool


2 Answers

For those who are using PHPUnit_Extensions_Selenium2TestCase and come hia from google.

@see https://github.com/sebastianbergmann/phpunit-selenium/issues/160

It should be as:

$this->execute(array(
    'script' => $javaScriptCode,
    'args'   => array()
));
like image 142
gaRex Avatar answered Aug 07 '26 06:08

gaRex


Using the instaclick webdriver you can execute javascript by using execute

for example:

$this->session->execute(array('script' => $script, 'args' => array())
like image 44
Jord Fox Avatar answered Aug 07 '26 07:08

Jord Fox