Automation Challenges in Selenium
Selenium is one of the leading, popular & preferred web automation tool, It is by far one of the best automation tools in the market. However; at the same time, there are few challenges automation engineer face during the actual implementation. Here, we tried to list a few of them and would be updated at regular intervals.
Selenium cannot handle windows based pop-ups, that leaves us in a situation to use third party tools to get past the situation in order to achieve the test objective. There are few open source tools which could be used to tackle window pop-ups like AutoIT. To know more on how to implement the real-time challenge contact Century IT Services..
Web Elements Dynamic in Nature
Our websites are designed/developed to cater to many scenarios, one such scenario is also to have elements which are dynamic in nature ex., Dynamic web table. this situation leads to having an element’s properties change upon every page load then. Further, it becomes tricky to handle these elements in the normal way. Such scenarios could be handled with dynamic xpath or dynamic CSS selectors. Some of the functions like starts-with, contains, ends with, etc., could be used to potentially solve the challenge. To know more on how to implement the real-time challenge contact Century IT Services..
Selenium provides an opportunity to work with multiple tabs using “Switchto” method, but in order to work with multiple tabs, one has to use window Handles to keep track of the tabs and use the appropriate handles to switch to a particular tab. To know more on how to implement the real-time challenge contact Century IT Services..
Page load and associated scenario
Web pages would load different elements depending on the different scenario. Certain scenarios demand elements to appear depending upon the previous action. In runtime, selenium script may not identify the element which is generated based on the actions performed and the time it takes to load. To overcome such situation we need to use explicit waits in the script which would give sufficient time to page load and to identify the element. To know more on how to implement the real-time challenge contact Century IT Services..
Selenium cannot generate a good report. But reporting is a vital part of the testing activity and through which quality of the application could be measured. In order to achieve reporting, we can use TestNG, NUnit, Extent reports etc. To know more on how to implement the real-time challenge contact Century IT Services..
IF VS. ASSERT STATEMENTS – WHEN TO USE WHICH
If and Assert statements serve different purpose, but they are similar functions. Here we would talk about usage of “if” and when to use “asserts” in our automation scripts.
If Clause – An “If” clause is a condition that can be either True or False.
if( isElementPresent(By.id(“Sample”)) )
System.out.println(“Sample Element found”);
System.out.println(“Sample Element not found”);
Assert Statement – An “Assert” statement is a condition that can be either True or False.
Well then what’s the difference? In the case of assert test would stop upon failure of the assert whereas in the case of If clause it just continues to execute rest of the test.