Posts

Showing posts from December, 2016

Test Automation - Myths and Reality

TEST AUTOMATION IS SIMPLE, THAT EVERY TESTER CAN DO IT  This myth is promoted by the tool sales people. They are trying to promote the following test automation process:   - Record the script   - Enhance the script by adding functions and data driving  - Run the scripts  - Report results   Under the influence of this myth the QA manager can proudly report: All our testers are developing test automation. REALITY - TEST AUTOMATION IS A SOFTWARE DEVELOPMENT TASK   Automation should be designed, developed and tested  You need to have some kind of a programming background to implement test automation. Test Automation is not as complex as C++/C#/Java development.  Test automation standards should be developed  Automated test components are assets that should be treated like application source code

Highlighting WebElement in Selenium

We can highlight the WebElements under action during the execution to help capture them while failure analysis. It can be done using the below code. Have the utility function in for framework ,use it for all the actions performed at the framework level. See the sample below. Function to highlight the WebElement under execution: public static void elementHighlight(WebElement element ) { JavascriptExecutor js = (JavascriptExecutor) driver ; js .executeScript( "arguments[0].setAttribute('style',arguments[1]); , element , "color: red; border: 3px solid red;" ); } Use it as below, used in the plain function here, you need to embed it in your framework as to highlight all the elements under action. public static void main(String[] args ) throws InterruptedException {         System.setProperty( "webdriver.gecko.driver" , "Path to geckodriver" ); driver = new FirefoxDriver(); driver .get( &q

Handling SSL Certificates Errors with Selenium WebDriver

Image
Below are some of the sample SSL Certificate errors Firefox 2. IE 3. Chrome How do we bypass these pages through selenium webdriver. Its handled using the DesiredCapabilities class and setting up the Capability for handling SSL Error as below. DesiredCapabilities capability = DesiredCapabilities.chrome();  // To Accept SSL certificate  capability.setCapability(CapabilityType.ACCEPT_SSL_CERTS,  true ); Then later pass the ‘capability’ object to the driver constructors as below. Firefox : FirefoxDriver driver =new FirefoxDriver(capability); 2. Chrome : System.setProperty( “webdriver.chrome.driver” ,  “E:/chromedriver.exe” ); ChromeDriver driver =  new  ChromeDriver(capability); 3. IE : System.setProperty( “webdriver.ie.driver” ,  “E:/IEDriverServer.exe” ); InternetExplorerDriver driver =  new  InternetExplorerDriver(capability);

Selenium Grid- Complete guide

Image
Grid Installation/Set up Prerequisite 1.      Java installed on the machine and environment variable set for Java (JAVA_HOME). 2.      Eclipse installed. 3.      TestNG is installed in eclipse. Steps to install grid 1.      Download selenium server jar from  Selenium Downloads Page , you will find it under section “ Selenium-Server (formerly Selenium-RC) ”. 2.      Extract it in your system say C drive . For Demonstration purposes , I will be assuming the path of selenium server jar is “C:\”. Why do we need Selenium Grid 1.      To test Browser and OS compatibility for UI tests in parallel. For example, you want to test your application for multiple combinations of OS and browser like chrome on Windows 7, 8 and 10. IE 9, 10 and 11 etc.   2.      To save execution time by distributing the tests on a.       Multiple machines b.      Running on multiple browser instances on same machine. Which will run in parallel. How Selenium grid works ·        HUB