Selenium is a well-known open source testing tool, which provides a robust set of tools that supports rapid development of test automation for web-based applications. It provides a vast set of testing functions designed to fit the needs of testing web applications. Operations in Selenium allow many options for locating UI elements and methods to compare expected test results with actual real-world application behavior. It also supports almost all web browsers to run test cases and also supports many different programming languages to help create or modify test scripts. Languages such as: Java, Ruby, PHP, .Net, C#, Perl, etc.
Challenges faced using selenium automation testing, and how to solve them
Selenium at times fails to function correctly if a dynamic event or change takes place during the test cycle. A few common problems faced are listed below, along with how to mitigate them with selenium test automation.
- Dealing with pop-up windows: Selenium can sometimes fail to record common popups in web apps. To handle any kind of alert popup, you can apply a getAlert function. Before actually running the script, you must import a package that can generate a WebDriver script for handling alerts. The efficient interface brings with it the following commands: void dismiss(), void accept (), getText(), void sendKeys(String stringToSend). The first two basically click on the “cancel” and “OK” buttons respectively on a popup window.
- No event trigger from value changes: Because Selenium does not initiate events with a change in values, one must do it oneself using fireEvent: selenium.FireEvent(cmbCategory, “onchange”);
- Timeout resulting from synchronization problems: One should ideally use selenium.IsElementPresent(locator) to verify that the object is in a loop with Thread.Sleep
- Testing Flash apps: To automate flash apps with Selenium, one can use Flex Monkium. The application source code must be compiled with the swc files generated by Flex Monkium. Then the app and the Selenium IDE are connected, and the tests can be recorded with IDE.
- Unexpected error launching Internet Explorer. Browser zoom level should be set to 100% by default for the IE browser to overcome this error
- Protected Mode must be set to the same valueerror occurs when trying to run Selenium WebDriver on a fresh Windows machine. This issue can be fixed by using capabilities as below when launching IE
DesiredCapabilities caps = DesiredCapabilities.internetExplorer(); caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true); WebDriver driver = new InternetExplorerDriver(caps);
* On June 1, 2015, SeleniumHQ labeled Gallop Solutions as an Aluminum Level Sponsor on their official website, www.seleniumhq.org. This recognition confirms Gallop’s position as a specialized software testing service provider, committed to making sure clients get value from their QA investments. Attending Selenium Conference 2015 at Portland, Oregon on Sep 8-10th 2015? Schedule a meeting with us.