javabrowserjythonruntime.execjython-2.7

Open a specific browser with Jython


I would like to open a specific browser with Jython.

I believe this is how it is done with Java:

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

I've tried to convert the Java to Jython:

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

However, it fails:

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

Is it possible to open a specific browser with Jython?


Solution

  • The direct answer to your question is, "No."

    Because Automation Scripts run 100% on the server side (even on the server-side of the server-side), they have zero direct control over the client / browser. You could format a URL into an attribute and use that attribute for a Launch in Context configuration item, but that's about as close as you come to manipulating the client / browser, unless you want to do a much more invasive customization.