I have a problem while testing my cases on browser stack. The problem am facing is inconsistently reproduced.
To make my code wait until an element is loaded am using as below:
gift_no_btn1 = Capybara.find('giftingNoButton')
Capybaras find methods will wait up to Capybara.default_max_wait_time seconds for a matching element to appear. If they are not waiting long enough either increase that setting or override it for a specific find with the :wait option like
page.find :css, 'CSS selector for the element', wait: 10
which will wait up to 10 seconds for the element to exist. In your example you're passing a CSS selector of 'giftingNoButton' which isn't really valid unless you're using custom elements. You probably want '#giftingNoButton' (find id matching) or '.giftingNoButton' (class matching)