public void Baidu() { ArrayList Fanem = new ArrayList(); string[] fa = new string[7]; pl.getElement("baidu").SendKeys("selenium hs"); Selp.sl(5); string st = pl.getElement("su").GetAttribute("Value"); Fanem.Add(st); fa[0] = st; fa[1] = "123"; fa[1] = "123"; Console.WriteLine("获取Text:{0}", st); Console.WriteLine(st); Fanem.Add(st); pl.getElement("su").Click(); Selp.sl(1); for (int i = 0; i < fa.Length; i++) { } foreach (var item in Fanem) { string ni = item.ToString(); Console.WriteLine("fanme[]:", ni); } }
public void UserSet() { string factory, devid, bn, bid, ln, did, dname; //预期序列号、自编号、车牌号、自编号、线路号、司机工号、司机姓名 ArrayList Fanem = new ArrayList(); //实际获取的值 factory = xmlConfig.gNode("Assertion/factory").InnerText; Console.WriteLine("获取的序列号:{0}", factory); ple.getElement("config_font_size").Click(); Selp.sl(5); string Fact = ple.getElement("序列号").Text; Fanem.Add(Fact); Console.WriteLine("实际序列号:{0}", Fact); Assert.AreEqual(factory, Fact); string fa4 = Fact.Substring(0, 4); //截取边序列 ple.getElement("车牌号").Clear(); //清空内容 ple.getElement("车辆自编号").Clear(); ple.getElement("线路号").Clear(); ple.getElement("工号").Clear(); ple.getElement("dname").Clear(); Console.WriteLine("输入自编号/车牌号:{0}", fa4); ple.getElement("序列号").SendKeys(fa4); ple.getElement("车牌号").SendKeys(fa4); ple.getElement("车辆自编号").SendKeys("fa4"); ple.getElement("线路号").SendKeys("fa4"); ple.getElement("工号").SendKeys("fa4"); ple.getElement("dname").SendKeys("fa4"); Selp.sl(10); }
public void TestSetUp() { string ti = "View MDVR"; string titi = drive.Title; Console.WriteLine("title:{0}", titi); Assertion.verifyEquals(ti, titi, "登陆成功或失败"); //判断登陆成功 ple.getElement("config").Click(); //进入config页面 Selp.sl(3); Console.WriteLine("Test:SetUp"); }
//[Test] public void UserNull() { //usernull String expected = "View MDVR"; String t = drive.Title; Console.WriteLine(t); ple.getElement("user").Clear(); ple.getElement("pwd").Clear(); //清楚用户密码 ple.getElement("pwd").SendKeys(pwd); //管理员密码amdin ple.getElement("login").Click(); Selp.sl(3); String tit = drive.Title; Console.WriteLine("获取标题为:{0}", tit); }
public void init() { //启动浏览器 WebDriver seleiun = new WebDriver(); drive = seleiun.getDriver(); //读取config参数,读取ip this.xmlConfig = Core.GetRMXML("config.xml", true); //加载xml string weburl = xmlConfig.gNode("Platform/IP").InnerText; //读取xml参数 weburl = "www.baidu.com"; drive.Navigate().GoToUrl(weburl); //s输入网址 pl = new LocatYyaml(drive, "Xpath.txt"); //传递webdr对象,读取文件参数 Console.WriteLine("访问地址URL:{0}", weburl); //drive.Manage().Window.Maximize(); Selp.sl(5); }
public void init() { //启动浏览器 WebDriver seleiun = new WebDriver(); drive = seleiun.getDriver(); //读取config参数,读取ip this.xmlConfig = Core.GetRMXML("config.xml", true); //加载xml string weburl = xmlConfig.gNode("Platform/IP").InnerText; //读取xml参数 drive.Navigate().GoToUrl(weburl); //s输入网址 ple = new LocatYyaml(drive, "Xpath.txt"); //传递webdr对象,读取文件参数 Console.WriteLine("初始化:访问地址URL:{0}", weburl); // drive.Manage().Window.Maximize(); //窗口最大化 Selp.sl(5); ple.getElement("user").Clear(); ple.getElement("pwd").Clear(); //清楚用户密码 ple.getElement("pwd").SendKeys(pwd); //管理员密码amdin ple.getElement("login").Click(); Selp.sl(3); }