使用 Jython 打开特定的浏览器

Open a specific browser with Jython

我想用 Jython 打开特定的浏览器。

我相信这是 how it is done with Java:

Runtime rt = Runtime.getRuntime();
rt.exec(new String[]{"cmd", "/c","start chrome http://www.whosebug.com"});

我尝试将 Java 转换为 Jython:

from java.lang import Runtime 
Runtime = Runtime.getRuntime()
Runtime.exec("start chrome http://www.whosebug.com");

然而,它失败了:

java.io.IOException: java.io.IOException: Cannot run program "start": CreateProcess error=2, 
The system cannot find the file specified in <script> at line number 3
BMXAA7837E - An error occured that prevented the TESTURL script for the LP23 launch point from running.
java.io.IOException: java.io.IOException: Cannot run program "start": CreateProcess error=2, The system 
cannot find the file specified in <script> at line number 3

是否可以使用 Jython 打开特定的浏览器?

您问题的直接答案是,"No."

因为 Automation Scripts 运行 100% 在服务器端(甚至在服务器端的服务器端),它们对客户端/浏览器的直接控制为零。您可以将 URL 格式化为属性并将该属性用于 Launch in Context 配置项,但这与您操作客户端/浏览器差不多,除非您想进行更具侵入性的自定义。