??????????????Framework?????????????????????μ??Framework????????????????????????????????????????????????????ù???????Product?????????????????????????????
???????????????
????????????????????????????????????????????ControlFactory?????????????????????????????????????????????????????????????????????????????JS????????????????????????????????????ID??Xpath????????????????????????????????????????????????в?????IPageAccess??Control??????PageAccess??????????????????webdriver??JS???

????1.1 ????????
????????Business Logic Layer??
????BUSIness Logic Layer???????????????????????????????????Page????λControl??????Control??
????1.????Page????????????????????????Page????Popup????????Iwebdriver????????????????????
????2.??λControl????????????JS?????????????????????δ??????????????ID??XPath????????л????
????3.????Coutrol??????????Page???????????????????????????????????????????????????????????????????

????2.1 BLL??????
????????IPageAccess??
????IPageAccess??????????????????????????С???????Coutrol????????????????巽???????????????IClickable??IMenu????????С?
namespace IPageAccess
{
public interface IClickable : IControl
{
bool Click();
}
}
???????PageAccess??
????PageAccess????????????????????????????????????????????????????????????webdriver??JS??????????????????????????????????????????????????ID??Name???????Dictionary???????????Dictionnary?????????λ???????????????????
namespace PageAccess.Portal
{
public class CPButton : CPBaseClickable
{
public CPButton(Dictionary<string?? string> info) : base(info) { }
protected override IWebElement Element()
{
IWebElement obj = null;
if (Id != "")
{
obj = WebDriverHelper.CurrentDriver.FindElement(By.Id(Id)?? 10);
}
else
{
if (Name != "")
{
obj = WebDriverHelper.CurrentDriver.FindElement(By.Name(Name)?? 10);
}
else
{
if (Selector != "")
{
obj = WebDriverHelper.CurrentDriver.FindElement(Selector?? 10);
}
else if (Xpath != "")
{
try
{
List<IWebElement> buttons = WebDriverHelper.CurrentDriver.FindElements(By.XPath(Xpath)?? 10);
buttons.Remove(buttons.Find(x => x.GetAttribute("class").Contains("mce_copy")));
if (buttons.Last().Enabled && buttons.Last().Displayed)
obj = buttons.Last();
else
obj = buttons.First();
}
catch
{
obj = null;
}
}
}
}
if (obj == null)
{
throw new Exception(string.Format("Button {0} can't be found."?? this.LabelRepository));
}
return obj;
}
public override bool Click()
{
}
#endregion
}
}
????4.1 PageAccess??Demo
?????????????????JS??selenium2???????????????????????Tool??????AutoIT???????Щ????????????????????RemoteWMI?????????