Wednesday, November 19, 2014

On 1:01 AM by Unknown   No comments
Answer 72Power of recovery scenarios lies with the programming language you use. If you are using java then you can use Exception handling to overcome same.

For example if you are reading data from a file and file is not available then you should keep you code statements in “try catch” block so that test execution could continue even in the wake of errors. Such mechanism entirely boils down the errors you want to recover from, while being able to continue with test execution.

Answer 73You can use loop features of the programming language, for example you can use “for” loop in java as following to type different test data in a text box –

// test data collection in an array 
       String[] testData = {"test1", "test2", "test3"};

// iterate through each test data 
     for (String s : testData) { 
              selenium.type(“elementLocator”, testData); 
     }

Answer 74You can use method getEval() to evaluate java script.

For example if you want to count number of images then you can pass following DOM statement to getEval() as following –

            selenium.getEval("window.document.images.length;");

Or to get all anchor objects from a page

            selenium.getEval("window.document.getElementsByTagName(‘a’);");

0 comments:

Post a Comment