Try to kill process using Webdriver | Selenium Forum
M
Posted on 02/11/2015
Hi Ashish

I [b:1ov4k7s1]try to kill the process[/b:1ov4k7s1], but I am getting Error-

[b:1ov4k7s1]Exception in thread "main" java.lang.NullPointerException: Unable to find executable for: taskkill[/b:1ov4k7s1]

I have attached screenshot with this question. [b:1ov4k7s1]Please provide your insights.
[/b:1ov4k7s1]
Code -

import org.openqa.selenium.os.WindowsUtils;

public class KillProcess {
public static void main(String[] args) {
WindowsUtils.killByName("notepad.exe");

}
}

M
Replied on 03/11/2015

[color=#FF0000:ggxdeu5r]Exception in thread "main" java.lang.NullPointerException: Unable to find executable for: taskkill[/color:ggxdeu5r]


This exception means there's a variable with null value being used. How to solve? Just make sure the "notepad.exe" can be found.


M
Replied on 03/11/2015

[quote="qtpselenium.supp0rt@gmail.com":ezh41vg8][color=#FF0000:ezh41vg8]Exception in thread "main" java.lang.NullPointerException: Unable to find executable for: taskkill[/color:ezh41vg8]


This exception means there's a variable with null value being used. How to solve? Just make sure the "notepad.exe" can be found.[/quote:ezh41vg8]


Please look into snapshot. notepad.exe is already opened.


M
Replied on 22/11/2015

I tried with other PC. Same code works flawless, but still unable to find the cause.