Skip to main content
deleted 9 characters in body
Source Link
alecxe
  • 11.4k
  • 11
  • 51
  • 107

I want the Script to Openfile.exeOpenfile.exe only if the previous one i.e CreateNew.exeCreateNew.exe has finished executing.

Right Now whats happening is, when I run TestNG.xml file it runs all the @Test@Test priority wise and within 5 sec TestNgTestNg output console shows all the @Test@Test are Passedpassed.

While my AutoIT scripts are still running in parallel in background.

The code is as follows:

@Test (priority=1)
public void CreateNew() throws Exception
{       
    Runtime.getRuntime().exec("exeFiles\\CreateNew.exe");       
}

@Test (priority=2)
public void OpenaFile() throws Exception
{
        Runtime.getRuntime().exec("exeFiles\\OpenaFile.exe");
}

And the code of AutoIt file is as Follows:

createnew()

Func createnew()
    Sleep(2000)
    Run("Mspaint.exe")
    WinWaitActive("Untitled - Paint")
    Send("!f")
    Sleep(1000)
    Send("n")
    Sleep(2000)
    WinClose("Untitled - Paint")
EndFunc   ;==>createnew

A possible solution for this can be:-

  • In your Java/Selenium code create a temparory lockfile
  • Start Autoit.exe
  • In your Java/Selenium code write a loop to check if lockfile still exists
  • Last step in the AutoIt code removes the lockfile
  • If the lockfile doesntdoesn't exist break out of loop and continue with the next code

Now does anyone know how to create and use this lockfile in code?

I want the Script to Openfile.exe only if the previous one i.e CreateNew.exe has finished executing.

Right Now whats happening is, when I run TestNG.xml file it runs all the @Test priority wise and within 5 sec TestNg output console shows all the @Test are Passed.

While my AutoIT scripts are still running in parallel in background.

The code is as follows:

@Test (priority=1)
public void CreateNew() throws Exception
{       
    Runtime.getRuntime().exec("exeFiles\\CreateNew.exe");       
}

@Test (priority=2)
public void OpenaFile() throws Exception
{
        Runtime.getRuntime().exec("exeFiles\\OpenaFile.exe");
}

And the code of AutoIt file is as Follows:

createnew()

Func createnew()
    Sleep(2000)
    Run("Mspaint.exe")
    WinWaitActive("Untitled - Paint")
    Send("!f")
    Sleep(1000)
    Send("n")
    Sleep(2000)
    WinClose("Untitled - Paint")
EndFunc   ;==>createnew

A possible solution for this can be:-

  • In your Java/Selenium code create a temparory lockfile
  • Start Autoit.exe
  • In your Java/Selenium code write a loop to check if lockfile still exists
  • Last step in the AutoIt code removes the lockfile
  • If the lockfile doesnt exist break out of loop and continue with the next code

Now does anyone know how to create and use this lockfile in code?

I want the Script to Openfile.exe only if the previous one i.e CreateNew.exe has finished executing.

Right Now whats happening is, when I run TestNG.xml file it runs all the @Test priority wise and within 5 sec TestNg output console shows all the @Test are passed.

While my AutoIT scripts are still running in parallel in background.

The code is as follows:

@Test (priority=1)
public void CreateNew() throws Exception
{       
    Runtime.getRuntime().exec("exeFiles\\CreateNew.exe");       
}

@Test (priority=2)
public void OpenaFile() throws Exception
{
        Runtime.getRuntime().exec("exeFiles\\OpenaFile.exe");
}

And the code of AutoIt file is as Follows:

createnew()

Func createnew()
    Sleep(2000)
    Run("Mspaint.exe")
    WinWaitActive("Untitled - Paint")
    Send("!f")
    Sleep(1000)
    Send("n")
    Sleep(2000)
    WinClose("Untitled - Paint")
EndFunc   ;==>createnew

A possible solution for this can be:-

  • In your Java/Selenium code create a temparory lockfile
  • Start Autoit.exe
  • In your Java/Selenium code write a loop to check if lockfile still exists
  • Last step in the AutoIt code removes the lockfile
  • If the lockfile doesn't exist break out of loop and continue with the next code

Now does anyone know how to create and use this lockfile in code?

added 27 characters in body; edited title
Source Link
IAmMilinPatel
  • 7.8k
  • 7
  • 43
  • 68

How to implement a lock in Selenium (Java)with Java?

I want the Script to Openfile.exe to only if the previous one i.e CreateNew.exe has finished executing.

Right Now whats happening is When, when I run TestNG.xml file it runs all the @Test Priority@Test priority wise and within 5 sec TestNgTestNg output Console Showsconsole shows all the @Test@Test are Passed. While

While my AutoIT scripts are still running parallelyin parallel in background.

The Codecode is as Followsfollows:

@Test (priority=1)
public void CreateNew() throws Exception
{       
    Runtime.getRuntime().exec("exeFiles\\CreateNew.exe");       
}

@Test (priority=2)
public void OpenaFile() throws Exception
{
        Runtime.getRuntime().exec("exeFiles\\OpenaFile.exe");
}

And the Codecode of AutoIt file is as Follows:

createnew()

Func createnew()
    Sleep(2000)
    Run("Mspaint.exe")
    WinWaitActive("Untitled - Paint")
    Send("!f")
    Sleep(1000)
    Send("n")
    Sleep(2000)
    WinClose("Untitled - Paint")
EndFunc   ;==>createnew

A Possible Solutionpossible solution for this can be:-

  • In your Java/Selenium code create a temparory lockfile
  • Start Autoit.exe
  • In your Java/Selenium code write a loop to check if lockfile still exists
  • Last step in the AutoIt code removes the lockfile
  • If the lockfile doesnt exist break out of loop and continue with the next code

Now Does Anyone knowsdoes anyone know how to Createcreate and Useuse this lockfile in Codecode?

How to implement a lock in Selenium (Java)

I want the Script Openfile.exe to only if the previous one i.e CreateNew.exe has finished

Right Now whats happening is When I run TestNG.xml file it runs all the @Test Priority wise and within 5 sec TestNg output Console Shows all the @Test are Passed. While my AutoIT scripts are still running parallely in background.

The Code is as Follows:

@Test (priority=1)
public void CreateNew() throws Exception
{       
    Runtime.getRuntime().exec("exeFiles\\CreateNew.exe");       
}

@Test (priority=2)
public void OpenaFile() throws Exception
{
        Runtime.getRuntime().exec("exeFiles\\OpenaFile.exe");
}

And the Code of AutoIt file is as Follows:

createnew()

Func createnew()
    Sleep(2000)
    Run("Mspaint.exe")
    WinWaitActive("Untitled - Paint")
    Send("!f")
    Sleep(1000)
    Send("n")
    Sleep(2000)
    WinClose("Untitled - Paint")
EndFunc   ;==>createnew

A Possible Solution for this can be:-

  • In your Java/Selenium code create a temparory lockfile
  • Start Autoit.exe
  • In your Java/Selenium code write a loop to check if lockfile still exists
  • Last step in the AutoIt code removes the lockfile
  • If the lockfile doesnt exist break out of loop and continue with the next code

Now Does Anyone knows how to Create and Use this lockfile in Code?

How to implement a lock in Selenium with Java?

I want the Script to Openfile.exe only if the previous one i.e CreateNew.exe has finished executing.

Right Now whats happening is, when I run TestNG.xml file it runs all the @Test priority wise and within 5 sec TestNg output console shows all the @Test are Passed.

While my AutoIT scripts are still running in parallel in background.

The code is as follows:

@Test (priority=1)
public void CreateNew() throws Exception
{       
    Runtime.getRuntime().exec("exeFiles\\CreateNew.exe");       
}

@Test (priority=2)
public void OpenaFile() throws Exception
{
        Runtime.getRuntime().exec("exeFiles\\OpenaFile.exe");
}

And the code of AutoIt file is as Follows:

createnew()

Func createnew()
    Sleep(2000)
    Run("Mspaint.exe")
    WinWaitActive("Untitled - Paint")
    Send("!f")
    Sleep(1000)
    Send("n")
    Sleep(2000)
    WinClose("Untitled - Paint")
EndFunc   ;==>createnew

A possible solution for this can be:-

  • In your Java/Selenium code create a temparory lockfile
  • Start Autoit.exe
  • In your Java/Selenium code write a loop to check if lockfile still exists
  • Last step in the AutoIt code removes the lockfile
  • If the lockfile doesnt exist break out of loop and continue with the next code

Now does anyone know how to create and use this lockfile in code?

Tweeted twitter.com/StackSQA/status/759366847439527936
edited tags
Link
Sandeep
  • 333
  • 2
  • 5
  • 20
Source Link
Sandeep
  • 333
  • 2
  • 5
  • 20
Loading