Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8039733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:40:13+00:00 2026-06-05T03:40:13+00:00

For our BDD tests we use Specflow that talks to selenium 2 webdriver (Chrome

  • 0

For our BDD tests we use Specflow that talks to selenium 2 webdriver (Chrome driver in this instance).

While running on local host (Yes, “it works on my machine” has came up in conversation a few times) the tests work fine. They setup the data and a new webdriver, do the test and then tear down the webdriver and data. Even if a test goes horribly wrong because I’m using correct attributes the tear down is always hit and therefore driver.Quit() is run destroying the browser and the driver.

The problem arises when I run it on our server [Windows Server 2008 r2] using our continuous integration [TeamCity]. For some reason it will start to run multiple driver instances which cause the tests to fail.

Has anyone ran into this problem before and found a fix? We need a solution that uses a driver that isn’t HtmlUnitDriver.

Extra information:

  • Language = C#
  • Server = Windows Server 2008 R2
  • CI = TeamCity

EDIT:
The Webdriver is set up by making sure that it isn’t already created and then creates a new instance of the ChromeDriver. Pseudo/real code example bellow shows how its set up, sorry I cant show the full code as it has to much fluff in that we use for other options that we stick in (e.g zap or fiddler integration / language changes etc).

Setup

[SetUp]
[BeforeScenario()]
public static void BeforeWebScenario()
{
   if driver == null
     driver = new ChromeDriver();
   // Code to start page
}

Tear down

[TearDown]
[AfterScenario()]
public static void AfterWebScenario()
{
   try
   {
       driver.Quit();
   } catch (Exception)
   {
       throw Exception
   }
   driver = null;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T03:40:15+00:00Added an answer on June 5, 2026 at 3:40 am

    I had this problem too. I fixed it by killing any running instances of chromedriver.exe in my testSetup() method. I used a VBScript and some Groovy code to run the scripts. Sorry this answer is kind of long.

    I had this in my setUp):

    if (wshsc.isRunningByCommandLineContents("chromedriver.exe"))
        wshsc.killProcessByCommandLineContents("chromedriver.exe")
    

    isRunningByCommandLineContents:

    If WScript.Arguments.Count = 1 Then
    
    strCmdLine = WScript.Arguments.Item(0)
    On Error Resume Next
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set objShell = CreateObject("WScript.Shell")
    Set colProcessList = objWMIService.ExecQuery _
        ("Select * from Win32_Process")
    If colProcessList.Count > 0 Then
        For Each objItem in colProcessList
            If (InStr(objItem.CommandLine, strCmdLine)) Then
                If (InStr(objItem.CommandLine, "cscript")) Then
                Else
                    WScript.StdOut.Write "A process is running with " + strCmdLine + " in its command line = " + objItem.Name
                End If  
            End If
        Next
    End If
    End If
    

    killProcessByCommandLineContents:

    If WScript.Arguments.Count = 1 Then
    strProcess = WScript.Arguments.Item(0)
    On Error Resume Next
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set objShell = CreateObject("WScript.Shell")
    Set colProcessList = objWMIService.ExecQuery _
        ("Select * from Win32_Process")
    
    If colProcessList.Count > 0 Then
        For Each objItem in colProcessList
            If InStr(objItem.CommandLine, strProcess) Then
                If (InStr(objItem.CommandLine, "cscript")) Then
                Else
                    WScript.StdOut.Write objItem.Name + " "
                    objItem.Terminate()
                End If
            End If
        Next
    Else
        WScript.StdOut.Write "No instances found running"
    End If
    Else
    WScript.StdOut.Write "Bad Arguments"
    End If
    

    And the “run the scripts part”:

    public void killProcessByCommandLineContents(String contents) {
        List<String> arg = new ArrayList<String>()
        arg.add(contents)
        String [] args = arg.toArray()
        runScript("killByCmdLineContents.vbs", args, true)
    }
    public boolean isRunningByCommandLineContents(String contents) {
        List<String> arg = new ArrayList<String>()
        arg.add(contents)
        String [] args = arg.toArray()
        String returnData = runScript("IsRunningByCmdLineContents.vbs", args, true)
        if (returnData.contains(contents)) {
            return true
        } else {
            return false 
        }
    }
    public String runScript(String name, String [] args, boolean returnOutput) {
        String s = null;
        List<String> cmdLine = new ArrayList<String>()
        cmdLine.add("C://Windows//System32//cscript.exe")
        cmdLine.add(dir + "dir//src//com//misc//wshScripts//" + name)
        int index = 0
        args.each() {
            cmdLine.add(args[index])
            index++
        }
    
        try {
            String [] cmdLineArray = cmdLine.toArray()
            Process p = Runtime.getRuntime().exec(cmdLineArray, null);
            if (returnOutput) {
                BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
                BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
                String dataToReturn
                Log.logger.info("Standard output: ");
                while ((s = stdInput.readLine()) != null) {
                    Log.logger.info(s)
                    dataToReturn = s // should get last line
                }
    
                Log.logger.info("Standard error: ");
                while ((s = stdError.readLine()) != null) {Log.logger.info(s);}
                return dataToReturn
            } else {
                return ""
            }
        }
        catch (IOException e) {
            Log.logger.info(e.message, e);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm in the process of refactoring our SpecFlow-implemented BDD tests. As part of this
I work with a team that uses Behaviour Driven Development(BDD) to deliver our applications.
I am trying to learn how to use BDD for our development process and
We are employing BDD and using SpecFlow to drive our development (ATDD). Our QA
Our team (QA) is facing the following problem: We have a database that is
Our server is running under CentOS 6 and handled over Panel Plesk 10.4.4. Structure
Our customer has asked that our application be able to communicate through HTTPS. The
Our iPhone app code currently uses NSURLConnection sendSynchronousRequest and that works fine except we
Our current project does not use Hibernate (for various reasons) and we are using
Our company is facing some difficulties with our CMS web application. This application was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.