Skip to main content

Posts

Showing posts from June, 2016

Block Push Notification on Chrome in Selenium Webdriver

Many of you might already know that Chrome browser supports push notification  almost on all platforms from version 42  and many sites including Facebook and Google+ have already started delivering push notification for end users. So when it comes to automating such sites/apps first thing that you notice is browser asking permission to deliver push notification. Facebook asking for permission to show push notification Problem Statement:- As you can observe in above image that it would be impossible to perform immediate next action in browser after login as it’s been blacked-out. Chrome driver will wait for sometime (implicit wait) and then try to perform next step in browser, whatever it may be, it will fail and if you missed the step in execution which might cause failure of next step and result would be failed test/test suite. Also push notification badges are not getting displayed as part of web document, so clicking on those button displayed is not possible through selenium. Worka

Selenium as a Windows Service

I have been playing with selenium grid from past few days and it becomes very tedious to me to setup the grid by firing commands in command prompt [I am mostly windows 7 user]. So I thought of running selenium grid as service and for that I have used NSSM - the Non-Sucking Service Manager. To set up grid as service, obviously you need- Selenium-server-standalone-2.53.0.jar file (should work with other version but I have used this) NSSM Selenium Grid Hub setup:-     You need to have following files in folder ready to use before you start with this setup. My folder setup is like-     To set up hub, we use following command in the command prompt. java -jar selenium-server-standalone-2.53.0.jar -role hub Check whether grid hub is up and running as shown in below image- Now if you accidentally close your command prompt running, your hub will go down which used happen a lot to me as I was not very keen user of command prompt. By setting up this as service, anyone can get rid of orphan l

MongoDBClient for Java Application

Singleton MongoDBClient for Java Application Reason to recommend not to close MongoDB driver connection:- The MongoDB Java driver provides a MongoClient class for the connection of your Java application with the MongoDB database.            The mongodb java client maintains (example below) a connection pool, which is relatively expensive to set up [even in faster network it takes 100 of milliseconds, apart from that each driver connection would run in separate thread and it will consume memory], so one should reuse the MongoClient instance across the lifetime.             A Connection Pool is a cache of database connections maintained by the driver so that connections can be reused when new connections to the database are required. To reduce the number of connection pools created by your application, it is recommend to call MongoClient.connect once. So it becomes obvious to create one instance of the MongoClient and to reuse it in every request of your application and not to close i

Page Object Model

           Once you start with automation, a word you will constantly get bombarded with is   ‘Framework ' which is a very generic term .   Wiki   defines a Test  Automation Framework as an integrated system that sets the rules of automation of a specific product. This system integrates the function libraries, test data sources, object details and various reusable modules. The article has also listed various approaches for designing test automation framework, sadly people categorize them as automation frameworks without understanding that it is just approach to design test automation. Approach of automation framework that one should choose/take must be depends upon the need of AUT .           Similarly, many folks misunderstood or I am not sure why they call Page Object as framework. It is NOT a framework, it is a Design Pattern which has many advantages . Though there are many resources available on internet on how to implement page object model, very few of them mentions be