Selenium testing Iframe

[TestFixture]

public class Search : SeleniumBase

{

  [Test]

  public void Search()

  {

      try

      {

          string path = "Search";

         CaptureScreen(path, "HomePage.jpg");

         selenium.Click("link=MAP SEARCH");

         selenium.WaitForFrameToLoad(SeleniumConfig.GetHostURL + @"/Search", "100000");



         //select iframe

         selenium.SelectFrame("//iframe[@src='/Search']");

         CaptureScreen(path, "Map.jpg");



         selenium.Type("id=key", "London");

         selenium.Click("id=searchPoint");

         Thread.Sleep(5000);



         //back to main window

         selenium.SelectWindow("null");

         Thread.Sleep(5000);

     }

     catch (Exception ex)

     {

         verificationErrors.Append(ex.Message);

         throw ex;

     }

 }

你可能感兴趣的:(selenium)