Selenium Remote-Control

Using selenium.SelectWindow in Webdriver 

Here is the Selenium RC code for selenium.SelectWindow in Webdriver. This code is in Visual Studio C#

public void SelectWindow(string Text)
{
driver.SwitchTo().Window(Text);
}

By Pavandeep Puddupakkam on December 14, 2011 | WebDriver | A comment?
Tags: , ,

Using selenium.SelectFrame in Webdriver 

Here is the Selenium RC code for selenium.SelectFrame in Webdriver. This code is in Visual Studio C#

public void SelectFrame(string xpath)
{
driver.SwitchTo().Frame(xpath);
}

Using selenium.DeleteAllVisibleCookies in Webdriver 

Here is the Selenium RC code for selenium.DeleteAllVisibleCookies in Webdriver. This code is in Visual Studio C#

public void DeleteAllVisibleCookies()
{
driver.Manage().Cookies.DeleteAllCookies();
}

Using selenium.waitForElementPresent in Webdriver 

Here is the Selenium RC code for selenium.waitForElementPresent in Webdriver. This code is in Visual Studio C#

public bool waitForElementPresent(string Xpath)
{
bool present = false;
for (int second = 0; ; second++)
{
if (second >= 5)
{
break;
}
if (IsElementPresent(Xpath))
{
present = true;
break;
}
Thread.Sleep(1000);
}
return present;
}

Using selenium.Refresh in Webdriver 

Here is the Selenium RC code for selenium.Refresh in Webdriver. This code is in Visual Studio C#

public void Refresh()
{
driver.Navigate().Refresh();
}

By Pavandeep Puddupakkam on | WebDriver | A comment?
Tags: , ,

Using selenium.IsTextPresent in Webdriver 

Here is the Selenium RC code for selenium.IsTextPresent in Webdriver. This code is in Visual Studio C#

public bool IsTextPresent(string text)
{
try
{
return driver.PageSource.Contains(text);
}
catch (Exception)
{
return false;
}
}