我使用Selenium IDE创建了多个脚本。我只能在使用扩展程序的Firefox中运行此脚本。我想使用node.js在Chrome / IE等不同浏览器上运行这些脚本。我知道我可以通过java命令运行它,但有什么方法可以通过nodejs运行它吗?
答案 0 :(得分:0)
可以使用selenium jar文件从命令行触发运行IDE测试套件。您可以从该命令行启动任何浏览器(而不仅仅是Firefox)。
Webdriver支持javascript / node: http://www.seleniumhq.org/download/ http://seleniumhq.github.io/selenium/docs/api/javascript/index.html
但要在其他浏览器中运行IDE测试,请查看此处的文档: https://wiki.mozilla.org/Running_IDE_scripts_with_Selenium_RC
java -jar selenium-server.jar -userExtensions user-extensions.js -htmlSuite "*chrome" "<base URL>" "<Selenium test suite file>" "<results log file>" -timeout nnnn
具体看看-htmlSuite之后的第一个参数:
第一个参数是运行脚本的浏览器。在RC 1.0.1 * chrome中 = Firefox,* iehta = Internet Explorer。 (RC 1.0.2中的选项预计分别为* firefox和* iexplore)