C# and page factory - FindsBySequence used multiple times doesn't work.

225 views
Skip to first unread message

Łukasz Yabol

unread,
Jan 25, 2016, 5:45:58 AM1/25/16
to Selenium Users
Hello guys, 

Did someone tried using FindsBySequence multiple times when writing test in c#. 
I have something like that 

    [FindsBySequence]
        [FindsBy(How = How.CssSelector, Using = "div.container.divPromoImages div.row.visible-sm.visible-md.visible-lg")]
        [FindsBy(How = How.CssSelector,Using = ("div.col-md-3.col-sm-3.hidden-xs.promo"))]
         private IList<IWebElement> _promoDeals;

        [FindsBySequence]
        [FindsBy(How = How.CssSelector, Using = "div.container.divPromoImages div.row.visible-sm.visible-md.visible-lg")]
        [FindsBy(How = How.CssSelector, Using = ("div.newsletterButton div.row div.col-sm-9.textWrappe"))]
        private IList<IWebElement> _promoDeals2;
 
When I'm using only first FindsBySequence everything is correct elements are find correctly. Bu when I added second FindsBySequence element it stopped to work 
and none element was found neither in first or second list . 

Can someone tell me what why it's behave this way and is there any workaround ?

Regards 
Lukasz


Vacan

unread,
Sep 9, 2016, 8:28:25 AM9/9/16
to Selenium Users
Hi Lukasz,

Did you figure this out?  I wonder if the apparent syntax error in each 2nd FindsBy is causing the problem?  You have parentheses around Using values...

Would changing 
[FindsBy(How = How.CssSelector,Using = ("div.col-md-3.col-sm-3.hidden-xs.promo"))]

to
[FindsBy(How = How.CssSelector,Using = "div.col-md-3.col-sm-3.hidden-xs.promo")]

make any difference for you?
Reply all
Reply to author
Forward
0 new messages