selenium-webdriverdeploymentwindows-server-2012

How to deploy selenium project in .NET core to a windows Server


I have a Selenium Project to test the overall UI performance of another project, it's all working fine locally. The issue now is the deployment. Since the testers who will use it would not be running it on visual studio IDE.

Your help and direction will be deeply appreciated.

I have tried searching for solutions online, but i didn't come across any tangible information that will help.


Solution

  • You can solve this by creating a .exe file from a .NET console app:

    1. Create a console app project
    2. Write your script in program.cs so that the project has an entry point
    3. Select Build Solution option and go to the output folder which normally is in C:\Users\[user]\source\repos\[repo name]\bin\Debug\net7.0\files...
    4. .zip the entire folder and share it with the testers
    5. Unzip all files onto the Windows Server 2012 and run the [projectname].exe

    Example of my program.cs Selenium script:"

    using (driver = new EdgeDriver(Options))
    {
        try
        {
            selenium = new(driver);
            Console.WriteLine($"Starting script {measurement.ScriptName}");
            Transaction1("T01_OpenMysolution", send, blob);
        }
        catch (Exception e)
        {
            Console.Error.WriteLine("Something went wrong in the script: " + e.Message);
        }
    };
    

    I'm just using Top-level statements in my entry point class: Top-level statements - programs without Main methods