0
我需要从selenium RC执行javascript,任何人都有关于如何执行的想法?如何在PHP上使用Selenium RC执行Javascript
我试过如下:
中写道用户extensions.js下面的自定义函数:
function sayhello() {
document.write('hello');
}
,并呼吁它WelcomeCept.php如下:
<?php
$I = new WebGuy($scenario);
$I->wait(3000);
selenium.getEval('sayhello');
命令:
php codecept.phar运行验收WelcomeCept.php
结果:
Codeception PHP Testing Framework v1.5.5 Powered by PHPUnit 3.7.14 by Sebastian
Bergmann.
Suite acceptance started PHP Fatal error: Call to undefined function
getEval() in
/home/user/Projects/selenium/tests/acceptance/WelcomeCept.php on line
103
FATAL ERROR OCCURRED. TESTS NOT FINISHED. Call to undefined function
getEval() in
/home/user/Projects/selenium/tests/acceptance/WelcomeCept.php:103
它说:调用未定义的函数 getEval() – 2013-03-08 10:27:58
检查您是否得到selenium.runscript('sayhello()')相同的错误; – Hemanth 2013-03-08 10:42:32
检查Stackoverflow中的以下链接。你可能会有一些想法。 http://stackoverflow.com/questions/7321255/how-do-i-inject-a-js-function-in-my-selenium-tests – Hemanth 2013-03-08 10:57:25