function check_tx(locator) {if (is_xpath_selector(locator))
{if (casper.exists(x(locator))) return true; else return false;}
if (casper.exists(locator)) return true; // check for css locator
// first check for exact match then check for containing string
if (casper.exists(x('//*[@id="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(@id,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[@name="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(@name,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[@class="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(@class,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[@title="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(@title,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[@aria-label="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(@aria-label,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[text()="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(text(),"'+locator+'")]'))) return true;
if (casper.exists(x('//*[@href="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(@href,"'+locator+'")]'))) return true;
return false;}
// for checking if given locator is found
for checking if given locator is found
for checking if given locator is found
function check_tx(locator) {if (is_xpath_selector(locator))
{if (casper.exists(x(locator))) return true; else return false;}
if (casper.exists(locator)) return true; 
if (casper.exists(x('//*[@id="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(@id,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[@name="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(@name,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[@class="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(@class,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[@title="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(@title,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[@aria-label="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(@aria-label,"'+locator+'")]'))) return true;
if (casper.exists(x('//*[text()="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(text(),"'+locator+'")]'))) return true;
if (casper.exists(x('//*[@href="'+locator+'"]'))) return true;
if (casper.exists(x('//*[contains(@href,"'+locator+'")]'))) return true;
return false;}
function check_tx ( locator ) { if ( is_xpath_selector ( locator ) ) { if ( casper . exists ( x ( locator ) ) ) return true ; else return false ; } if ( casper . exists ( locator ) ) return true ; if ( casper . exists ( x ( '//*[@id="' + locator + '"]' ) ) ) return true ; if ( casper . exists ( x ( '//*[contains(@id,"' + locator + '")]' ) ) ) return true ; if ( casper . exists ( x ( '//*[@name="' + locator + '"]' ) ) ) return true ; if ( casper . exists ( x ( '//*[contains(@name,"' + locator + '")]' ) ) ) return true ; if ( casper . exists ( x ( '//*[@class="' + locator + '"]' ) ) ) return true ; if ( casper . exists ( x ( '//*[contains(@class,"' + locator + '")]' ) ) ) return true ; if ( casper . exists ( x ( '//*[@title="' + locator + '"]' ) ) ) return true ; if ( casper . exists ( x ( '//*[contains(@title,"' + locator + '")]' ) ) ) return true ; if ( casper . exists ( x ( '//*[@aria-label="' + locator + '"]' ) ) ) return true ; if ( casper . exists ( x ( '//*[contains(@aria-label,"' + locator + '")]' ) ) ) return true ; if ( casper . exists ( x ( '//*[text()="' + locator + '"]' ) ) ) return true ; if ( casper . exists ( x ( '//*[contains(text(),"' + locator + '")]' ) ) ) return true ; if ( casper . exists ( x ( '//*[@href="' + locator + '"]' ) ) ) return true ; if ( casper . exists ( x ( '//*[contains(@href,"' + locator + '")]' ) ) ) return true ; return false ; }
for checking if given locator is found
for checking if given locator is found
// check for css locator // first check for exact match then check for containing string