Add try catch block for ids retrieval in phantomjs