Trying this on a faster machine and against some other pages, I'm noticed 
flaws in my previous testing. Some of the properties, ex Element#height, 
start as if the sliding container was visible. When the animation starts, 
they get reset. For example, I saw the height go from 346, down to 1 and 
back up to 346. Similar when checking the overflow style. You need to make 
sure the element is present before you start inspecting the properties.

Checking the overflow as Titus mentioned seems to be the most robust, at 
least for this specific implementation:

def continue_as_guest
  browser.div(id: 'slide-dialog-container').wait_until do |s|
    s.present? &&
    s.style('overflow') == 'visible'
  end
  continue_as_guest_element.click
end

Justin


On Tuesday, September 25, 2018 at 2:42:02 PM UTC-4, Justin Ko wrote:
>
> Element#height didn't work for me. It was returning height of the div 
> including the part cut-off by the overflow. The clientHeight gave the 
> height excluding the cut-off portion.
>
> Justin
>
>
> On Tuesday, September 25, 2018 at 2:33:06 PM UTC-4, Titus Fortner wrote:
>>
>> Also, Watir has a `Element#height` method, so you shouldn't need to 
>> resort to JS to get that value.
>>
>>
>>
>> On Tuesday, September 25, 2018 at 11:31:32 AM UTC-7, Titus Fortner wrote:
>>>
>>> Yeah, it's clicking, but I suspect JS event isn't ready to act yet. 
>>>
>>> Note the style transition attributes there. Try waiting for the element 
>>> style to not include "overflow" after the element becomes present. You can 
>>> also try waiting for the size of the slide dialog container to equal some 
>>> value, but that's more hacky. :)
>>>
>>>
>>>
>>> On Tuesday, September 25, 2018 at 9:04:27 AM UTC-7, NaviHan wrote:
>>>>
>>>> Hi Titus & Justin
>>>>
>>>> My theory of actually clicking the button before the pop is fully 
>>>> loaded could be wrong, because even if its not fully loaded the click on 
>>>> "continue as guest" should dismiss the popup.
>>>>
>>>> Please see the video here 
>>>>
>>>>
>>>> https://drive.google.com/file/d/1ycWdST29FptgOS5GYDfRuAPUVBfeQt3h/view?usp=sharing
>>>>
>>>> But what made me think that the button is actually clicked is the 
>>>> screenshot taken at the point of failure, which has a highlighter around 
>>>> the "continue as guest" button which indicated the button is clicked.
>>>>
>>>> https://i.imgur.com/TdhYPz4.png
>>>>
>>>> Both are contradictory.
>>>>
>>>> What do you think?
>>>>
>>>>
>>>> On Tuesday, 25 September 2018 14:41:15 UTC+10, NaviHan wrote:
>>>>>
>>>>> Its been some days I found this issue untill I understood today the 
>>>>> cause of failure.
>>>>>
>>>>> The behavior is
>>>>> a. The user enters the email on check out page
>>>>> b. A pop up skids in from the top of the page
>>>>> c. The user clicks a "continue as guest "button on the pop up
>>>>> d. The pop up skids back in and disappears
>>>>> e. Verify the pop up disappeared
>>>>>
>>>>> The issue is between step b and step c there is a time when the pop up 
>>>>> is sliding into the page until its loaded completely. During this time 
>>>>> the 
>>>>> script clicks the dismiss button. Because the pop hasent completed 
>>>>> loading 
>>>>> the click doesn't make it disappear.
>>>>>
>>>>> Similarly becasue the pop up takes time to slide back and disapper the 
>>>>> check at step e fails.
>>>>>
>>>>> For the time being Im working around this issue with sleeps. But is 
>>>>> there a neater way?
>>>>>
>>>>>
>>>>> The pop up is defined as 
>>>>>
>>>>> button(:continue_as_guest, :class => ['button', 'close-dialog-button'])
>>>>>
>>>>>
>>>>> The code that does the job is 
>>>>>
>>>>> def continue_as_guest
>>>>>   continue_as_guest_element.wait_until(&:present?).click
>>>>> end
>>>>>
>>>>>
>>>>> After sleep, which works fine
>>>>>
>>>>> def continue_as_guest
>>>>>   sleep 5
>>>>>   continue_as_guest_element.wait_until(&:present?).click
>>>>>   sleep 5
>>>>> end
>>>>>
>>>>>
>>>>> Note:- I have also tried to wait_while(&:present?) still the issue 
>>>>> stays the same
>>>>>
>>>>> def continue_as_guest
>>>>>   
>>>>> continue_as_guest_element.wait_until(&:present?).tap(&:click).wait_while(&:present?)
>>>>> end
>>>>>
>>>>>
>>>>>
>>>>>

-- 
-- 
Before posting, please read 
https://github.com/watir/watir_meta/wiki/Guidelines-for-Posting-to-Watir-General-Google-Group.
 
In short: search before you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com
--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to