javascript - Selenium Webdriver - How to execute Perl command with parameters in selenium-Java framework code -
i working on selenium framework java scripting. need use series of perl commands execute inject data system before validating selenium java scripts.
how execute perl scripts inside selenium java code ?
runtime.getruntime().exec()
function run code through java code. asking parameter passing. understand there variables want pass in script.
yes, can using + operator. similer concat string in java using + operator. pass them. posting sample code same. below code execute perl script.
use below code:-
string myvariable = "data"; process process; try { process = runtime.getruntime().exec("perl c:\\users\\shubham\\desktop\\"+myvariable+"\\rouge-1.5.5.pl"); process.waitfor(); if (process.exitvalue() == 0) { system.out.println("command successful"); } else { system.out.println("command failure"); } } catch (exception e) { system.out.println("exception: " + e.tostring()); } } }
hope :)
Comments
Post a Comment