Upload
indicthreads
View
123
Download
3
Embed Size (px)
Citation preview
Improve Testing Efficiency With Selenium WebDriverSurendran EthirajXpanxion International Pvt. Ltd
Agenda
Selenium – An IntroSelenium Tool’s SuiteSelenium RC (Versus) Selenium WebDriverWhat’s new? - Selenium WebDriverAdvanced concepts in WebDriverDemo
What is Selenium?
• Selenium is a set of different software tools for automating web applications.
• Can be used for most of the browser/platform combinations.
• Supports many languages including Ruby, Python, Java etc.
• Open source and free.
Selenium’s Tool Suite
• Selenium IDE.• Selenium RC.• Selenium 2.0 (WebDriver).• Selenium Grid.
Selenium RC
Selenium WebDriver
Advantages of WebDriver
One should use WebDriver when requiring improved support for
* Multi-browser testing including improved functionality for browsers not well-supported by Selenium-1.0.* Handling multiple frames, multiple browser windows, popups, and alerts.* Page navigation.* Drag-and-drop.* AJAX-based UI elements.
8
Advancing in WebDriver
Using Java/JQuery scripts Retrieving Java script errors Identifying broken links Handling ‘Wait’ in WebDriver Reporting Server-client responses Reporting Page load timings Cross browser testing
Using Java/JQuery ScriptsSelenium WebDriver 2.0 provides us an Interface ‘JavaScriptExecutor’ to execute JS/Jquery scripts independent or within the application
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("alert('Hello from Selenium!');");
Retrieving JavaScript Errors
Identifying JSErrors Cross Browser
For Firefox :We have to add an plugin
“JSErrorCollector.xpi” in Firefox profile which aids to identify the Java script errors on the page and the same could be retrieved using JavaScriptErrorCollector API.
List<JavaScriptError> jsErrors = JavaScriptError.readErrors(driver);
Other Browsers:For Other Browsers: We need to add the below code in our application
and use JavaScript query to retrieving the details<script type="text/javascript">
window.onerror=function(msg){
var previous_errors = document.getElementsByTagName("body")[0].getAttribute("JSError");
$("body").attr("JSError",previous_errors + '\n' + msg );
}
</script>
Broken Links
Handling ‘Wait’ in WebDriver
Fluent Wait (withTimeOut, Polling mechanism)
Implicit Wait (withTimeOut)
Ajax load Wait (Developed through JQuery for verifying AJAX calls)
HAR (Http Archive Report)
• Exports HTTP tracing information for performance analytics
Data from HAR file
How long it takes to fetch the DNS information
How long each object takes to be requestedHow long it takes to connect to the serverHow long it takes to transfer from the
server to the browser of each objectWhether the object is blocked or not
Cross Browser Testing with Grid 2.0
SikuliWebDriver
SikuliFirefoxDriver extends Selenium's FirefoxDriver by adding Sikuli's image search capability. It is useful for automating interactions with highly visual interfaces such as Google Map.
“Testing is an infinite process of comparing the invisible to the ambiguous in order to avoid the unthinkable happening to the anonymous.” - James Bach
For Queries write to me [email protected]
Linked In: in.linkedin.com/pub/surendran-ethiraj/5/946/a11