我需要从selenium RC执行javascript,任何人都知道如何做到这一点?
我尝试了以下内容:
在user-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
答案 0 :(得分:0)
我认为,用双引号sayhello
代替""
代替单引号''
将符合您的目的。
编辑单引号或双引号不是罪魁祸首。我正在尝试调试这个问题。