You have basically two questions,
For first I am agree with Talktokets answer.Talktokets answer.. For safety, you can use waitForElementPresent.
For second, yes you can use the exported java code. For beginners it will be fruitfull. After sometime, you can learn to edit/modify these codes according to your use, and then you can write such codes by your own efficiently.