Posts

Showing posts from January, 2018

Headless Web Driver testing with Chrome on Headless Servers

Recently, I had a task to migrate the WebDriver based test cases from PhantomJs to Chrome headless and the tests were running on headless CI docker containers. The migration was not a smooth journey as I had anticipated and this article is based on my learning experience during this migration. PhantomJs was widely used for headless testing and now it has been unofficially abandoned by the PhantomJs team. So we had to switch to some other browser which is under active development and also which supports headless mode. The choice was Google Chrome (or Chromium). As more and more organizations move towards cloud containers or virtual machines to run their CI build, it is quite important to have the ability to run your WebDriver based tests in headless mode. My key learnings from this migration: Avoid using Xvfb (Virtual Frame Buffer) as virtual display when your test suite has hundreds of test cases.  Xvfb crashes in the middle of the test for unknown reason and Chrome fails to

Import Personal Information Exchange (.pfx or .p12) file on Mac

Steps to import Personal Information Exchange (.pfx or .p12) file on Mac using Keychain Access application Goto Keychain Access  application Click on System  Keychains Select File  menu -> Import Items.. Select downloaded_file.p12  file in the dialog box Enter your login password if prompted Enter the keystore password if prompted After successful import, you should see a new certificate Double click on the newly imported certificate Click the Trust  arrow to expand the trust attributes Change the value of When using this certificate:  to Always Trust Close the certificate dialog box and enter login password if prompted A blue '+' symbol should appear on the newly imported certificate, which means the certificate is imported and trusted

How to add additional dns host mapping to localhost

Why we need additional dns host mapping? In enterprise environments, some applications can serve into multiple domains. For example, same running instance(s) can be mapped for guest.example.com and customer.example.com and the functionality of the application could vary based on the domain being used by the user. Lets say, customer.example.com will need authentication, authorization and may contain premium features for customers, whereas guest.example.com will contain limited features. To test this type of application in local, which contains domain aware functionalities, we need to map additional routes in the OS host file to map these domains to localhost. And then the tests can make use of these domains to test the application running in local development machine. For Mac: Add the following lines to /private/etc/hosts file using vi or nano or any text editor application. Might need to use sudo if required. 127.0.0.1       local.example.com 127.0.0.1       loc

Installing chromedriver for Selenium WebDriver testing

For Mac: Using homebrew: brew install --cask chromedriver chromedriver --version Using manual steps: Add the following lines to ~./bash_profile  or ~/.zprofile using vi or nano or any text editor # Installing Chrome Driver export CHROME_DRIVER_HOME=/downloaded_and_extracted_location/chrome_driver_2.33 export PATH=$CHROME_DRIVER_HOME:$PATH Verify the installation by executing the following command in Terminal chromedriver --version For Windows: Add c: \downloaded_and_extracted_location\chrome_driver_2.33\chromedriver to PATH environment variable (most probably through My Computer). Verify the installation by executing the following command in Command Prompt chromedriver --version For Ubuntu (Linux): sudo apt-get install chromium-browser sudo apt-get install chromium-chromedriver sudo ln -s /usr/lib/chromium-browser/chromedriver /usr/local/bin/chromedriver chromium-browser --version chromedriver --version For Debian (Linux): sudo