Forum Discussion

chiragverma123's avatar
chiragverma123
Contributor
8 years ago

Running a external Selenium Python script from Grrovy script using SOAPUI

 I would like to run external python selenium scripts located in my project folder. Is it possible to do so? My goal is to run something on the UI before running the API test on SOAPUI. If yes, How can i achieve this?

  • This problem is now resolved. Using the following script:

     

     

    def cmdArray2 = ["python", "C:/Users/Desktop/SOAPProject/test.py"]
    def process = new ProcessBuilder(cmdArray2).redirectErrorStream(true).start()
    process.inputStream.eachLine {
    log.warn(it)
    }
    process.waitFor()
    return process.exitValue()

  • This problem is now resolved. Using the following script:

     

     

    def cmdArray2 = ["python", "C:/Users/Desktop/SOAPProject/test.py"]
    def process = new ProcessBuilder(cmdArray2).redirectErrorStream(true).start()
    process.inputStream.eachLine {
    log.warn(it)
    }
    process.waitFor()
    return process.exitValue()

  • nmrao's avatar
    nmrao
    Champion Level 3
    But you already seemed to be using selenium / groovy. Why too may approached are being choosen?

    If required, you may run it execute command from groovy.

    "cmd /c echo hello".execute()

    Similarly you can call python with the script name as argument. Give it a shot.