首页 > 解决方案 > Galen 框架:主要 gspec 中的 EcmaError 异常错误

问题描述

我尝试使用 github 上的示例实现 galen 响应式测试,但遇到此错误。我在 Java 中使用 galen 2.4.0。

public class ResponsiveTestManager extends GalenTestBase {

 private PropertiesManager pm;

 @BeforeSuite 
 public void setup() {
 pm = PropertiesManager.createInstance();
 }


 @Test(dataProvider = "devices")
 public void homepage_responsive(TestDevice device) throws IOException {
 load(pm.getProperties().getProperty("homepage"));
 checkLayout(System.getProperty("user.dir") + "\\galen_specs\\main.gspec", device.getTags());
 }
}

com.galenframework.parser.SyntaxException:语句中的 JavaScript 错误

引起:org.mozilla.javascript.EcmaError:ReferenceError:“run_in_grid”未定义。

主要的.gspec

@@ Set run_in_grid      selenium grid http://127.0.0.1:4444/wd/hub

Homepage in Selenium Grid
    ${run_in_grid} --page http://phptravels.net/login
        check homepage.gspec

主页.gspec

@objects
    login-username      css         input[name=username]    

为什么会出现这个 javascript 错误。如何解决这个问题?请帮忙。十亿感谢您的帮助。

我按照这个教程

标签: javagalen

解决方案


Is there a reason why @@ Set has an uppercase S here? Anyways, it doesn't seem to be neccessary to use the run_in_grid variable at all, so this main.gspec should work according to how variables work:

Homepage in Selenium Grid
    selenium grid http://127.0.0.1:4444/wd/hub --page http://phptravels.net/login
        check homepage.gspec

推荐阅读