I am trying to use Selenium Webdriver in visual studio to check a website. Everything worked fine when I was using just Chromedriver, but now that I have added the Microsoft Webdriver to test the site using Edge I am having issues. I made sure to download the correct version of the webdriver for my os build.
Every other time I go to run my test visual studio encounters a build error.
Warning Could not copy "C:\Desktop\UnitTestProject3\packages\Selenium.WebDriver.MicrosoftDriver.17.17134.0\build..\driver\MicrosoftWebDriver.exe" to "C:\Desktop\UnitTestProject3\UnitTestProject3\bin\Debug\MicrosoftWebDriver.exe". Beginning retry 9 in 1000ms. The process cannot access the file 'C:\Desktop\UnitTestProject3\UnitTestProject3\bin\Debug\MicrosoftWebDriver.exe' because it is being used by another process. The file is locked by: "Microsoft Web Driver (12804), Microsoft Web Driver (12340), Microsoft Web Driver (1124), Microsoft Web Driver (19756), Microsoft Web Driver (2592), Microsoft Web Driver (12736), Microsoft Web Driver (19604), Microsoft Web Driver (12428), Microsoft Web Driver (18604), Microsoft Web Driver (10500), Microsoft Web Driver (12724)"
If i dismiss the error and then run the test one more time it runs fine. Has anyone ran into this before?
Any help would be appreciated!
Thanks
Check your processes, May be MicrosoftWebDriver.exe is still running in process and that's why you would get build error.
If script fails abruptly, you need to handle your code to quit driver. Otherwise driver will remain active in processes.
Related
I am having some UI testcases, which are run using a Azure DevOps release pipeline. These testcases are working in Chrome and Firefox when I enable headless mode.
Now I want to enable a headless mode for Internet Explorer(IE11). When I searched on the web I found that this can be achieved using TrifleJs. How can implement TrifleJs in Visual Studio 2019? Can somebody provide the C# code?
Browser : IE11,
Server : Windows Server 2019 Datacenter
As far as I know, IE does not have support for a headless mode.
From the TrifleJs document, the TrifleJs is a kind of browser that can emulate some IE versions in a headless mode and execute JavaScript script, since its coded as a port of PhantomJS.
At present, it is an executable file, instead of a kind of SDK or API, so, we could not directly add it in C# application. I suggest you could check the document to use this tool, and you could also feedback this issue to trifleJS forum
I am beginner of learning C# selenium using visual studio 2015.
I want to test a random website using edge browser. With the use of NuGet, I have installed selenium support (latest version)v3.141.0, selenium webdriver (latest version)v3.141.0 and selenium microsoft webdriver (latest version)v17.17134.0. However, the OS version on my laptop (latest window 10) is 18362 which is not available to download on official webdriver website.
The following code works well in chrome, IE, and firefox, but if I run the script below, I could successfully open the edge browser, but it does not proceed any more steps accordingly (just a edge browser displaying blank page).
The error I get is as followed: OpenQA.Selenium.WebDriverException: "A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL http://localhost:54095/session. The status of the exception was ReceiveFailure, and the message was: the underlying connection was closed. An unexpected ...."
I searched through the entire internet but still could not find out any relevant resources teaching how to configure edge webdriver in my current situation. Can someone point out mistakes I made and advise what should be done to solve this issue?
[TestMethod]
public void TestInEdge()
{
// Default option, MicrosoftWebDriver.exe must be in PATH
IWebDriver driver = new EdgeDriver();
driver.Navigate().GoToUrl("http://testwisely.com/demo");
System.Threading.Thread.Sleep(1000);
driver.Quit();
}
Microsoft WebDriver for Microsoft Edge (EdgeHTML) versions 18 and 19 is a Windows Feature on Demand which ensures that it’s always up to date automatically and enables some new ways to get Microsoft WebDriver.
To get started you will have to enable Developer Mode:
Go to Settings > Update and Security > For Developer and then select
“Developer mode”.
To install run the following in an elevated command prompt:
DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0
Reference:
Microsoft WebDriver
Then after again try to run your code with Edge browser.
i have a angular project which triggers selenium Chrome-driver to open with help of c# API, it is working fine on my local machine. Now i have to deploy it on azure so my client can use in the same way too.
I tried and found out chrome-driver will only work on through azure VM-machine as it has some limitations. I purchased one azure VM and deployed my project there with chrome driver. it is working as a headless chrome-driver, i can see chrome driver is running in task manager but i cannot see the browser. Any help from anyone?
IWebDriver driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
driver.Url = "https://www.youtube.com";
I'm testing a .Net exe web application on my local machine using Selenium web driver in Visual Studio. To view the web UI I need to open a firefox browser and connect to http://localhost:12345
When I run this code
driver.Navigate().GoToUrl("http://localhost:12345");
a browser opens but just sits blank. Then I eventually get this error in VS:
'OpenQA.Selenium.WebDriverException : Failed to start up socket within 45000 milliseconds. Attempted to connect to the following addresses: 127.0.0.1:7055'
When I run the same test using Selenium IDE Firefox opens http://localhost:12345 correctly.
How do I get Firefox to open the localhost address I provide it in my C# code?
Thanks for taking the time to look at my question.
I have managed to find a solution which I will post here for anyone who encounters the same problem.
In order to access localhost I used Selenium Standalone Server instead of Web Driver. These are the steps:
1- In class under [Setup] enter
public void SetupTest()
{
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://localhost:12345/");
selenium.Start();
verificationErrors = new StringBuilder();
}
2- Download Selenium Standalone Server
4- Run Selenium Standalone Server using cmd java -jar selenium-server-standalone-version-number.jar
5- Run test in Visual Studio
And now it works.
I'm working on an activeX component of a web application with Visual Studio 2008 in Windows 7 and IE9. I have a method to test it so that i don't have to deploy it to the Web server to check whether it is working or not.
However, recently I noticed that IE9 has been using an unreleased version of the ActiveX component. I kept building and updating codes here and there, and apparently IE is grabbing that build version which is unreleased yet. The released version is available on the webserver, while the one i'm testing is not released yet as it is still incomplete.
Can anyone tell me how to prevent this from happening?