Added ptor_waitForElementById function to avoid 'Element is no longer attached to the DOM' error