Pages

Showing posts with label Selenium. Show all posts
Showing posts with label Selenium. Show all posts

Tuesday, March 16, 2021

Steps C# Edge driver and Selenium Test Project

Create NUnit or MSTest project

In project manager, install pacakge: Microsoft.Edge.SeleniumTools

Package will install:

  • Microsoft.Edge.SeleniumTools
  • Selenium.WebDriver
  • Selenium.Support
  • DotNetSeleniumExtras.PageObjects.Core 
**PageObjects were marked obsolete - instead of  OpenQA.Selenium.Support.PageObjects use SeleniumExtras.PageObjects namespace. 

Navigate to: WebDriver - Microsoft Edge Developer

Download latest Microsoft Edge Driver.


Open downloaded Microsoft Edge Driver zip file and save msedgedriver.exe to a local drive.

Must change driver's name from msedgedriver.exe to MicrosoftWebDriver.exe. 

**Changing name is a must or an error message:
 OpenQA.Selenium.DriverServiceNotFoundException : The file C:\Selenium\EdgeDriver\msedgedriver.exe does not exist. The driver can be downloaded at https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/

Reference EdgeDriver within Test fixture.


[Test] public void Test1() { //Open Browser IWebDriver webDriver = new EdgeDriver(@"C:\Selenium\EdgeDriver"); //Navigate to site webDriver.Navigate().GoToUrl("http://yoopergreens.com"); //Assert.Pass(); }
This post is for the purpose of my notes only and sometimes a rant.
“I invented nothing new. I simply assembled the discoveries of other men behind whom were centuries of work. Had I worked fifty or ten or even five years before, I would have failed. So it is with every new thing. Progress happens when all the factors that make for it are ready and then it is inevitable. To teach that a comparatively few men are responsible for the greatest forward steps of mankind is the worst sort of nonsense.”
Henry Ford

Sunday, December 4, 2016

Selenium IDE, C# Visual Studio, and MSTest

Within Visual Studio Package Manager install packages


Within Visual Studio package manager

  •     Install-Package Selenium.RC (optional)
  •     Install-Package Selenium.WebDriver
  •     Install-Package Selenium.WebDriverBackedSelenium
  •     Install-Package Selenium.Support

Or, download zip file from: Selenium Webpage

    Extact zip file.
    Within Visual Studio add reference to these dlls

  •     Selenium.WebDriverBackedSelenium.dll
  •     ThoughtWorks.Selenium.Core.dll
  •     WebDriver.dll
  •     WebDriver.Support.dll

Now, Visual Studio has reference Selenium

Download the Internet Explorer Driver Server from: Selenium Webpage


    Download should be a single .exe file: IEDriverServer.exe

    Very Important that the IE Driver is able to find IEDriverServer.exe


  • Move IEDriverServer.exe into MS Test project's bin\debug folder
  • Or, make sure IEDriverServer.exe absolute path is added to the Path environment variables.

Start > right click Computer > properties > Advance system settings


Environment Variables > scroll down to Path > Edit > add, at end of text, the folder's absolute path where IEDriverServer.exe is found.

 
Install Selenium IDE Firefox plugin


After installing plugin, open Firefox, click on Tools > Selenium IDE

 

Using Selenium IDE, record some actions by clicking IDE's record button.


Export as C# / NUnit / WebDriver and save into project's folder



Generated NUnit Test Class


After changer were made


Must Include reference to
  • Microsoft.VisualStudio.TestTools.UnitTesting
in projects.




Within Visual Studio, create a Unit Test Project




    Remove UnitTest1.cs file





This post is for the purpose of my notes only and sometimes a rant.

“I invented nothing new. I simply assembled the discoveries of other men behind whom were centuries of work. Had I worked fifty or ten or even five years before, I would have failed. So it is with every new thing. Progress happens when all the factors that make for it are ready and then it is inevitable. To teach that a comparatively few men are responsible for the greatest forward steps of mankind is the worst sort of nonsense.”
Henry Ford