Friday, May 24, 2019
[C#] TimeSpan
//TimeSpan stepTime = currentTime.Subtract(_startTime);
//TimeSpan elapsedTime = currentTime.Subtract(_globalStartTime);
//_startTime = currentTime;
////TimeSpan span = new TimeSpan(;
//timePrevious = DateTime.Now;
//timeCurrent = DateTime.Now.AddDays(1);
//timeSubtracted = timeCurrent.Subtract(timePrevious).TotalMinutes
Use below.
Globals.txt2 = DateTime.Now.ToString("HH:mm:ss");
Globals.time2 = Convert.ToDateTime(Globals.txt2);
TimeSpan dt = Globals.time2.Subtract(Globals.time1);
string ttt = Globals.txt1 + " " + Globals.txt2 + " " + dt.Seconds.ToString();
//MessageBox.Show(ttt);
Globals.txt1 = Globals.txt2;
Globals.time1 = Convert.ToDateTime(Globals.txt1);
Friday, April 26, 2019
How to Fix “Unable to delete chromedriver.exe” Error in Selenium
How to Fix “Unable to delete chromedriver.exe” Error in Selenium
When running Selenium tests, you may occasionally encounter an error like this:
Unable to delete file "C:\...\bin\Debug\chromedriver.exe".
Access to the path 'C:\...\bin\Debug\chromedriver.exe' is denied.
At first glance, this looks like a simple permission issue. However, in most cases, the real cause is that the chromedriver process is still running in the background.
This usually happens when:
The test did not shut down properly
The WebDriver instance was not fully disposed
A previous run left orphaned driver processes
In my case, the file remained locked after test execution, causing repeated build failures.
Quick Fix
The fastest way to resolve this is to manually terminate the running driver processes.
Open Command Prompt and run:
taskkill /f /im chromedriver.exe
taskkill /f /im geckodriver.exe
Example output:
SUCCESS: The process "chromedriver.exe" with PID 17196 has been terminated.
SUCCESS: The process "geckodriver.exe" with PID 8844 has been terminated.
After killing these processes, you should be able to rebuild and rerun your tests without issues.
Preventing the Issue
To avoid this problem in the future, make sure your test framework properly cleans up driver instances:
Always call
driver.Quit()Use
[TearDown]or[OneTimeTearDown]in NUnitEnsure cleanup runs even on failure (use
try-finally)
Final Thoughts
This is a small but frustrating issue that can interrupt your workflow.
By ensuring proper driver cleanup and knowing how to quickly kill leftover processes, you can keep your Selenium tests running smoothly.
If you want, I can also tailor this for Playwright or add C# code examples for cleanup.
Wednesday, March 27, 2019
[CodedUI] get current Url in codedUI
BrowserWindow browser = BrowserWindow.Launch();
//Some Code Here
Uri uri = browser.Uri;
string st = uri.ToString();
Friday, March 22, 2019
[CodedUI] Disable Run Test after Builds
Check if the Run Test After Builds button is clicked in Test-Test Settings.
Wednesday, March 20, 2019
Friday, March 15, 2019
[Windows] Disable the Internet Explorer Security Certificate
Disable the Internet Explorer Security Certificate
Open Internet Explorer and click on "Tools," or the gear icon. Click "Internet Options" and click on the "Advanced" tab. Navigate to the "Security" subheading and remove the check marks on both the “Check for publisher’s certificate revocation” and “check for server certificate revocation” options. Click "OK" and then click "Apply." You may have to restart your computer for the options to fully take effect. Reload the website you were attempting to visit.Tuesday, March 12, 2019
[WINDOWS] Find path for filename
C:\WINDOWS\system32>for %i in (cmd.exe) do @echo %~$PATH:i
C:\Windows\System32\cmd.exe
C:\WINDOWS\system32>for %i in (notepad.exe) do @echo %~$PATH:i
C:\Windows\System32\notepad.exe