【问题标题】:Workaround for getting variables from Selenium Server without using "Echo" or an additional language在不使用“Echo”或其他语言的情况下从 Selenium Server 获取变量的解决方法
【发布时间】:2014-10-24 22:53:58
【问题描述】:

我们公司销售的测试套件能够运行 selenium 测试以及其他几种协议。

要使用它,最终用户需要安装我们的应用程序和 selenium 服务器文件。

当用户根据他们在 IDE 中使用的命令编写测试用例时,每个命令都可以在 Selenium 服务器上运行,除了 echo 命令。这显然是 Selenium 服务器的一个已知限制,除了 echo 之外,每个 IDE 命令都可以工作。

这显然是故意的配置:echo command not found while testing selenium with phpunit

我们似乎无法找到一种方法让我们的应用程序在存储变量后从 Selenium Server 中取回它们……因为在 IDE 上运行的 echo 命令会从 Selenium Server 返回一个错误。

有多种语言的 Selenium Server 绑定,但不适用于我们的应用程序。由于我们的应用程序和 Selenium Server 是在 Windows 环境中分发给最终用户的——默认情况下,系统上没有安装第三方语言,如 Java、c-sharp、python 等。

是否有一种解决方法可以在不将整个编程语言安装到每个最终用户的 PC 上的情况下从 Selenium Server 中获取变量?

【问题讨论】:

  • Selenium 服务器依赖于 Java,不是吗?或者你打算如何在没有它的情况下执行 selenium 服务器?

标签: variables selenium echo


【解决方案1】:

我对 selenium 一无所知,但是 .Net 可以很好地安装在回到 XP 的每个 Windows 版本上(对于 XP,您必须自己安装)请参阅 What version of the .NET framework is installed on Windows XP, Vista, and 7?

因此,您应该可以访问诸如 C#(或任何 .Net 语言)之类的东西来编写您的解决方案。这可能意味着安装一个自定义软件来代替你Echo。 (但正如我所说,我对硒一无所知)

【讨论】:

    【解决方案2】:

    不确定这是否会有所帮助。 我编写了一个用户扩展命令,以便能够在我的日志文件中获取变量值。新命令采用与 echo 命令相同的参数,以及一个额外的参数,用于说明需要给出输出的 LOG 级别。对于数据驱动测试,我使用“警告”级别来过滤掉命令中用于数据读取和循环的所有 info LOG 消息。

        Selenium.prototype.doEchoLog = function(strMessage, Level) {   
    /**
      * Prints the specified message into the Log (log file) using the level as indicated in the second argument 
      *
      * @param strMessage the message to print
      * @param Level denote the logging level to be used for this message (debug | info | warn | error)
      */
    
    // translate the Level value to a usable one letter value        
        Level = Level.substring(0,1);
        // output the given message to the Log at the indicated level
        if (Level == "d" ) { LOG.debug(strMessage);
        } else if (Level == "i" ) { LOG.info(strMessage);
        } else if (Level == "w" ) { LOG.warn(strMessage);
        } else if (Level == "e" ) { LOG.error(strMessage);
        } else LOG.error("use: echoLog <text> <debug|info|warning|error>");
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-02-26
      • 2019-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-23
      • 1970-01-01
      相关资源
      最近更新 更多