java - How to verify whether a browser exists in selenium webdriver -
i using webdriver open firefox browser , iteratively pass url using spreadsheet (that contains 5 urls in different cells of column 1). if suppose manually close firefox browser after 2 urls opened. want script handle situation , continue execution tried below 3 conditions, everytime null pointer exception. please suggest how handle situation.
if (driver.tostring().contains("null")) if (driver.gettitle().contains("null")) if (driver.getcurrenturl().contains("null"))
there no inbuilt method can use workaround
/** * * @return true if driver alive else false */ public boolean isalive() { try { driver.getcurrenturl();//or driver.gettitle(); return true; } catch (exception ex) { return false; } }
Comments
Post a Comment