Hi Andrei,

Do you have an example of where an OR evaluation is useful? 

As Titus said, it's not usually the way to go. That said, I'm pretty sure 
I've done it before. The solution usually depends on what you are trying to 
do and the page. For example:

   - If you wanted to match elements with the class of "A" or "B", but not 
   "C", you could use a regular expression.
   - Some times I have found that looking at an ancestor or descendant 
   element can remove the need for an OR condition.
   - If there is really nothing in common between the elements you can 
   always brute force it by creating a list of elements and using the first 
   that exists - eg found_element = [browser.div, browser.span].find(&:exists?)
   
 Justin


On Wednesday, December 4, 2019 at 9:40:37 AM UTC-5, Titus Fortner wrote:
>
> Right, I'm not a big fan of that pattern, as it makes executing 
> deterministic tests more challenging. If you want to use it to apply to 
> multiple views like mobile/desktop, you're going to introduce race 
> conditions. If you want to use it to minimize brittleness you run the risk 
> of testing the wrong thing.
>
> Requiring explicitness in this case is a feature not a bug.
>
> On Wed, Dec 4, 2019, 6:32 AM Aionitoaie Andrei <andre...@gmail.com 
> <javascript:>> wrote:
>
>> Thanks,
>>
>> I was looking something more like OR evaluation.
>>
>> luni, 2 decembrie 2019, 22:38:45 UTC+2, Titus Fortner a scris:
>>>
>>> Watir allows you to locate elements with multiple locators with an 
>>> implied "AND" it does not support multiple locators with an "OR" evaluation.
>>>
>>> What is supported is described here: http://watir.com/guides/locating/
>>>
>>>
>>> On Monday, December 2, 2019 at 1:17:16 PM UTC-6, Aionitoaie Andrei wrote:
>>>>
>>>> Hi,
>>>>
>>>> Does Watir has something like identifying the same element using 
>>>> multiple locators? Something like Appium has: @AndroidFindBy and 
>>>> @IOSFindBy?
>>>>
>>>> Or maybe some suggestions about how to achieve this?
>>>>
>>>> Thanks,
>>>> Andrei
>>>>
>>> -- 
>> -- 
>> 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-...@googlegroups.com <javascript:>
>> http://groups.google.com/group/watir-general
>> watir-...@googlegroups.com <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 watir-...@googlegroups.com <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/watir-general/2205db86-bb17-4fb0-8f44-4c7137f65254%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/watir-general/2205db86-bb17-4fb0-8f44-4c7137f65254%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/watir-general/a14ebc28-e063-4271-83f2-94a577f2d482%40googlegroups.com.

Reply via email to