Home » Software Testing » Automation Testing » Selenium WebDriver Tutorial » Handling Windows Processes Through Selenium WebDriver

Handling Windows Processes Through Selenium WebDriver

Like QTP and other desktop and web-application based automation tool, WebDriver has capability to interact with process of windows operating system. Due to this complete post is going to teach you “Handling Windows Processes Through Selenium WebDriver”.

Handling Windows Processes Through WebDriver
For this purpose WebDriver API has one class WindowsUtils that handle all kind of processes related to windows.

WindowsUtils class help in killing or closing any running instance of any program on Windows operating system.Suppose there is some script that have some dependency of Notepad and you want to kill all instance of notepad before running the script.It means we need to place one code that would kill the notepad instance and then script would start executing then for this purpose we will use one method tryToKillByName() by name in WindowsUtils class.




So our generic code would be like this

tryToKillByName() function can kill any instance of program by its name and if some processes are coming in to way of script execution those are creating run time error then it really helps to proceed with plan B to kill the all running instance of process though the code.

This Class have many other functions that helps in changing/read the value of registry  and those are like




suppose you want to know what kind of operating system you are using then you can use this code

but to use this WindowsUtils we need to import the org.openqa.selenium.os.WindowsUtils class and if you are using IDE then things get more easy because one hit of CTRL + Space give a lot of option and it all depends upon us to select the kind of function that we need to choose for our specific action.

So have a good time with this WindowsUtils and I am pretty sure that you have learnt “Handling Windows Processes Through Selenium WebDriver”

4 thoughts on “Handling Windows Processes Through Selenium WebDriver”

  1. Hi Dwarika,

    When I tried the above code for RegistryValue, as soon as I hit run, suddenly “Obsolete Mathods on the stach” popup box appears.
    Inside it, it says “This package.class at localhost:49185 contains obsolete methods”

    Please help me in seeing this code is working.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: