示例#1
0
        public void DevtestLocalTestCase2()
        {
            Browser firefox = new FireFox("http://devtest.local");

            firefox.GoTo("http://devtest.local");
            firefox.Close();
        }
示例#2
0
        //[Test()]
        public void GoogleTest()
        {
            Browser firefox = new FireFox();

            firefox.GoTo("http://www.google.com");
            firefox.TextField(Find.ByName("q")).Value = "WatiN";
            firefox.Button(Find.ByName("btnG")).Click();
            Assert.IsTrue(firefox.ContainsText("WatiN"));

            firefox.Close();
        }
示例#3
0
 //[TestMethod]
 public void TestGOMHomeLoad()
 {
     browser = new FireFox();
     try
     {
         browser.GoTo(Constants.GOMobileWebHost);
         Assert.AreEqual(browser.Url, Constants.GOMobileWebHost);
     }
     finally
     {
         browser.Close();
     }
 }
示例#4
0
 //[TestMethod]
 public void TestGOMHomeTitleLoad()
 {
     browser = new FireFox();
     try
     {
         browser.GoTo(Constants.GOMobileWebHost);
         Assert.IsTrue(browser.Title.Contains(Constants.GOMobileWebHostTitle));
     }
     finally
     {
         browser.Close();
     }
 }
示例#5
0
 //[TestMethod]
 public void TestGOMHomeHeaderBGImageLoad()
 {
     browser = new FireFox();
     try
     {
         browser.GoTo(Constants.GOMobileWebHost);
         string GossipTitleContent = browser.Div(Find.ById("GossipTitle")).InnerHtml;
         Assert.AreEqual(GossipTitleContent, Constants.GOMobileWebHostTitle);
     }
     finally
     {
         browser.Close();
     }
 }
示例#6
0
 private static void SearchAndGoToRandomLink(string pathKeyWords)
 {
     using (StreamReader streamReader = new StreamReader(pathKeyWords))
     {
         string empty        = string.Empty;
         string outputFolder = Program.CreateOutputFolder();
         string str;
         while (!string.IsNullOrEmpty(str = streamReader.ReadLine()))
         {
             FireFox browser = (FireFox)null;
             try
             {
                 Console.WriteLine(string.Format("Consultando palavra chave:{0}", (object)str));
                 string fileName = str.Trim().Replace(" ", "+");
                 browser = new FireFox(string.Format("https://www.google.com.br/search?q={0}", (object)fileName));
                 Program.CreateOutputFile(fileName, browser, outputFolder);
                 Console.WriteLine();
                 List <string> searchLinks = Program.FindSearchLinks(browser);
                 Console.WriteLine();
                 string url = Program.ChooseRandomLink(searchLinks);
                 browser.GoTo(url);
                 Thread.Sleep(1000);
                 browser.Close();
                 Thread.Sleep(1000);
             }
             catch
             {
                 Console.WriteLine("There was an unhadled error, but I'll continue working Seymour.");
             }
             finally
             {
                 try
                 {
                     browser?.Close();
                 }
                 catch
                 {
                 }
             }
         }
     }
 }