As of 6.13 you can now that wait like this:

b.label(id: 'something').wait_until(text: 'Expected Text')


On Thursday, September 13, 2018 at 4:40:53 AM UTC-7, rajagopalan madasami 
wrote:
>
> Hi Navi,
>
> yes, you are right with your understanding.
>
> WATIR locates elements completely different from Selenium
>
> When you write, 
>
> element=b.span(id: 'click')
>
> It doesn't locate the element, but when you write
>
> element.click
>
> it locates the element and continue to perform the click operation, this 
> arrangement is useful to relocate the element when element goes to stale, 
> waiting until element is visible and likewise this arrangement is useful 
> for cases. Technically this should include even when I call text method as 
> well. But I do in my project here is,
>
> I write code like
>
> b.wait_until(b.label(id: 'something').text?'Expected Text')
>
> This will reexecute the statement for 30 seconds, otherwise it would throw 
> the error
>
> Or 
>
> b.label(id: 'something').wait_until{|element| element.text.eql?'Expected 
> Text'}
>
>
>
> On Thu, Sep 13, 2018 at 11:16 AM NaviHan <[email protected] 
> <javascript:>> wrote:
>
>> Hi Titus
>>
>> Thats makes it very clear now :-)
>>
>> Just to confirm, action methods as in set, click, select
>> And the reading attribute values like id, text, or any other custom 
>> attribute are not auto covered and we need to use wait_until(&:present?)
>>
>> Is that correct?
>>
>> Cheers
>> Navi
>>
>> On Tuesday, 11 September 2018 14:52:33 UTC+10, NaviHan wrote:
>>>
>>> This is something that keeps me a bit sceptic when I write and read the 
>>> automation code in my project.
>>> This used PageObjects.
>>>
>>> I have seen extensive use of element referces, for example 
>>>
>>> button(:add_to_bag, :css => '#add-to-cart')
>>> add_to_bag.element.when_present.click
>>>
>>>
>>>
>>> instead of 
>>>
>>> add_to_bag 
>>>
>>> which directly clicks the element
>>>
>>> I have also seen extensive use of referencing elements using 
>>> <element>.when_present, <element>.wait_until_present etc
>>>
>>> Im confused where we should draw the line when deciding to reference the 
>>> element and actually using it(as in directly calling "add_o_bag" in the 
>>> above example to click the element.
>>>
>>> Any thoughts?
>>>
>>>
>>> -- 
>> -- 
>> 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.
>>  
>> [email protected] <javascript:>
>> http://groups.google.com/group/watir-general
>> [email protected] <javascript:>
>> --- 
>> 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 [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
-- 
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.

[email protected]
http://groups.google.com/group/watir-general
[email protected]
--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to