added exception and xpath check for element not found