【问题标题】:Open a specific browser with Jython使用 Jython 打开特定浏览器
【发布时间】:2020-02-17 22:54:40
【问题描述】:

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

我相信这是how it is done with Java

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

我尝试将 Java 转换为 Jython

from java.lang import Runtime 
Runtime = Runtime.getRuntime()
Runtime.exec("start chrome http://www.stackoverflow.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 打开特定的浏览器?

【问题讨论】:

标签: java browser jython runtime.exec jython-2.7


【解决方案1】:

您的问题的直接答案是“不”。

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

【讨论】:

  • 您是否曾在 Maximo 消息框中看到过超链接?还是消息框中的按钮背后有一些代码?
  • 我想我已经在某个地方使用过的“maxmessage”(DB Config 中的消息选项)中放入了一个,但是那个内存有点模糊。我肯定会再试一次。我知道我已经在其中添加了&lt;br/&gt; 标签。
猜你喜欢
  • 1970-01-01
  • 2021-05-21
  • 2013-10-08
  • 1970-01-01
  • 2020-02-17
  • 1970-01-01
  • 2019-04-12
  • 2015-09-07
  • 1970-01-01
相关资源
最近更新 更多