我们正在将Selenium测试转换为使用Selenium-Grid。
我正在尝试找到一种方法来启动selenium-grid的中心和/或远程,这样它就可以使用我们之前创建的user-extensions.js。除了我们的扩展之外,我已经能够让所有的东西都能与我们的旧测试一起工作。
通过在线搜索,我发现您可以编辑selenium-grid根目录中的project.properties文件,并添加user_extension_file属性以指向user-tensions.js。
user_extension_file=${basedir}/user-extensions.js我还尝试使用相对路径和绝对路径来表示该属性的值,但它们都不起作用。我已经尝试将其添加到Hub的根selenium-grid文件夹和RC的根selenium-grid文件夹中。
有人知道怎么做吗?谢谢。
发布于 2010-07-22 06:54:50
好了,我(终于)弄清楚了。使用ant任务启动Remote Control时,您可以执行以下操作:
ant launch-remote-control -DseleniumArgs="-userExtensions path/to/user-extensions.js" ...这就像一个护身符。:)
发布于 2010-07-20 13:47:28
你试过使用setExtensionJs吗?
基本上,扩展Javascript必须在浏览器启动之前指定,并且在会话关闭之前一直处于活动状态。
selenium = new DefaultSelenium('localhost', 4444, '*firefox', 'http://alistapart.com');
def extensionJs = new File('selenium-core/src/main/resources/core/scripts/ui-map-sample.js').text;
selenium.setExtensionJs(extensionJs);
selenium.start();
selenium.open('http://alistapart.com');
selenium.click('ui=allPages::section(section=topics)');
selenium.waitForPageToLoad('5000');
selenium.stop();来自:http://ttwhy.org/home/blog/2008/05/14/selenium-rc-per-session-extension-javascript/
https://stackoverflow.com/questions/3284653
复制相似问题