I have been trying to get FindSingle or TryFindSingle to work for my situation and it works... sort of.
We have a deal site and the side bar displays all the "additional" deals. Unfortunately our the exact location of these frames to click to get to the deal varies by a DIV or so. I need to click the deals in the side bar.
I can get FindSingle and TryFindSingle to select the first deal but not subseqent deals - even when i drill down.
Code: Select all
WebElement webE = "/dom[@domain='" + Domain + "']/body/form/div[@id='bd']/div[@id='bd']/div[3]/div[2]/div[1]/div/div";
WebElement imgBuy;
bool bFound = webE.TryFindSingle("//img[@alt='Buy']", out imgBuy);
imgBuy.Click();
Code: Select all
WebElement webE = "/dom[@domain='" + Domain + "']/body/form/div[@id='bd']/div[@id='bd']/div[3]/div[2]/div[1]/div/div/";
WebElement imgBuy = webE.FindSingle("//img[@alt='Buy']");
imgBuy.Click();
deal 1: /body/form/div[@id='bd']/div[@id='bd']/div[3]/div[2]/div[1]
deal 2: /body/form/div[@id='bd']/div[@id='bd']/div[3]/div[2]/div[2]
deal 3: /body/form/div[@id='bd']/div[@id='bd']/div[3]/div[2]/div[3]
Its just the remaining DIVs that vary.
When I try to make the variable webE for deal2 or deal3 it still finds deal1 even though it shouldn't be in that realm.
Code: Select all
WebElement webE = "/dom[@domain='" + Domain + "']/body/form/div[@id='bd']/div[@id='bd']/div[3]/div[2]/div[2]/div/div/";
WebElement imgBuy = webE.FindSingle("//img[@alt='Buy']");
imgBuy.Click();
Or if I try to make imgBuy the place where I give the more specific location - this errors out.
Code: Select all
WebElement webE = "/dom[@domain='" + Domain + "']/body/form/div[@id='bd']/div[@id='bd']/div[3]/div[2]";
WebElement imgBuy = webE.FindSingle("//div[2]/div/div/img[@alt='Buy']");
imgBuy.Click();
Thanks
Sierra