Selenium remote testing via Teamcity.
Can anyone provide steps to getting a basic selenium 2 unit test to run? I have been struggling with this for quite some time. below are the steps I have take to now be at the current position:
local machine: install selenium IDE for firefox. Create very basic test via IDE. file > export as c# Nunit WebDriver
run the test via Nunit and VS2010. both pass fine.
upload to teamcity.
when using xpath = Driver.FindElement(By.XPath("/html/body/div/div/div[2]/ul/li[4]/a")).Click();
fail:failed. OpenQA.Selenium.ElementNotVisibleException : Element is not currently visible and so may not be interacted with
when using Driver.FindElement(By.LinkText("Invoice")).Click();
fail: OpenQA.Selenium.NoSuchElementException : Unable to locate element: {"method":"link text","selector":"Invoice"}
I have tried adding timeout as well like this
public void SetupTest()
{
baseURL = "http://dev.finance.portal/";
driver = new FirefoxDriver();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(30));
Selenium = new WebDriverBackedSelenium(driver, baseURL);
Selenium.Start();
verificationErrors = new StringBuilder();
}
can someone please help me out with steps to getting a webdriver version of selenium to pass via teamcity?
here is a basic test structure
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using Selenium;
namespace WorkBench
{
[TestFixture]
class Program
{
public IWebDriver Driver;
public ISelenium Selenium;
private string baseURL = "http://dev.finance.portal/";
[SetUp]
public void Setup()
{
Driver = new FirefoxDriver();
Selenium = new WebDriverBackedSelenium(Driver, baseURL);
Selenium.Start();
}
[TearDown]
public void TearDown()
{
}
[Test]
public void TestMouseOver()
{
Driver.Navigate().GoToUrl(baseURL);
Driver.FindElement(By.LinkText("Invoice")).Click();
//Selenium.ClickAt("link=Invoice","10,10");
//Selenium.MouseOver("link=Invoice");
}
}
Please sign in to leave a comment.