Selenium is a great tool for testing your user interface (UI). There are plenty of great tutorials on the web that I encourage you to review. This article is going to cover some basic setup steps and a simple .NET Core 2.1 code sample.
Browser Settings
- Assumptions: Chrome/Firefox (64-bit)/IE11/Edge (Win10 or higher).
- Most of these settings have to be done for IE11 as the modern browsers do this by default or the alternative usually still works.
- Always open pop-ups in a new tab.
- Turn off pop-up blockers.
- IE11: Enable Protected Mode for all security zones.
- Disable save password prompts.
- When prompted to AutoComplete, click “No”.
- Set zoom to 100%.
- Restart the browsers.
Windows Settings
- Disable the logon screen save while you’re sitting back watching your automated tests run the screen saver does not kick on ruining your test.
- Restart the computer.
Set the WebDrivers
- IE 11.
- https://www.seleniumhq.org/download/
- Under “The Internet Explorer Driver Server” section > click “32 bit Windows IE.”
- Extract “IEDriverServer.exe” from the zip to c:Selenium.WebDrivers
- https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
- Edge version 18 or great, then run the following in command prompt as an administrator.
- DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0.
- Edge version less than 18, then do the following.
- Under “Downloads” > Microsoft Edge (EdgeHtml) > click the top Release.
- Save “MicrosoftWebDriver.exe” to c:Selenium.WebDrivers.
- Since this version is in Preview I did not download and test but here are the steps.
- https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
- Under “Downloads” > Microsoft Edge (Chromium) > for the top Release click x64.
- Extract “msedgedriver.exe ” from the zip to c:Selenium.WebDrivers.
- https://sites.google.com/a/chromium.org/chromedriver/
- Under “All versions available in Downloads” next to the “Latest stable release” click the ChromeDriver link > Click “chromedriver_win32.zip.”
- Extract “chromedriver.exe” from the zip to c:Selenium.WebDrivers.
- https://github.com/mozilla/geckodriver/releases
- Under the latest release v#.##.# under “Assets” click the geckodriver-*-win64.zip.
- Extract “geckodriver.exe” from the zip to c:Selenium.WebDrivers.
Create the Application
The full source code is in https://github.com/penblade/Tips/tree/master/Tips.Selenium.
Selenium is a great tool for testing your user interface (UI). There are plenty of great tutorials on the web that I encourage you to review. This article is going to cover some basic setup steps and a simple .NET Core 2.1 code sample.
Browser Settings
Assumptions: Chrome/Firefox (64-bit)/IE11/Edge (Win10 or higher).
Most of these settings have to be done for IE11 as the modern browsers do this by default or the alternative usually still works.
Always open pop-ups in a new tab.
Turn off pop-up blockers.
IE11: Enable Protected Mode for all security zones.
Disable save password prompts.
When prompted to AutoComplete, click “No”.
Set zoom to 100%.
Restart the browsers.
Windows Settings
Disable the logon screen save while you’re sitting back watching your automated tests run the screen saver does not kick on ruining your test.
Restart the computer.
Set the WebDrivers
IE 11.
https://www.seleniumhq.org/download/
Under “The Internet Explorer Driver Server” section > click “32 bit Windows IE.”
64 bit should also work, but some consultants I worked with recommended the 32 bit over 64 bit as of 12/2018.
Extract “IEDriverServer.exe” from the zip to c:Selenium.WebDrivers
Microsoft Edge (EdgeHtml).
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Edge version 18 or great, then run the following in command prompt as an administrator.
DISM.exe /Online /Add-Capability /CapabilityName:Microsoft.WebDriver~~~~0.0.1.0.
Edge version less than 18, then do the following.
Under “Downloads” > Microsoft Edge (EdgeHtml) > click the top Release.
Save “MicrosoftWebDriver.exe” to c:Selenium.WebDrivers.
Microsoft Edge (Chromium).
Since this version is in Preview I did not download and test but here are the steps.
https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
Under “Downloads” > Microsoft Edge (Chromium) > for the top Release click x64.
Extract “msedgedriver.exe ” from the zip to c:Selenium.WebDrivers.
Chrome.
https://sites.google.com/a/chromium.org/chromedriver/
Under “All versions available in Downloads” next to the “Latest stable release” click the ChromeDriver link > Click “chromedriver_win32.zip.”
Extract “chromedriver.exe” from the zip to c:Selenium.WebDrivers.
Firefox.
https://github.com/mozilla/geckodriver/releases
Under the latest release v#.##.# under “Assets” click the geckodriver-*-win64.zip.
Extract “geckodriver.exe” from the zip to c:Selenium.WebDrivers.
Create the Application
The full source code is in https://github.com/penblade/Tips/tree/master/Tips.Selenium. […]