Search
 
 

Display results as :
 


Rechercher Advanced Search

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

OpenQA.Selenium.NoSuchElementException : Unable to find element

View previous topic View next topic Go down

OpenQA.Selenium.NoSuchElementException : Unable to find element

Post by Djaved on Thu Feb 16, 2012 7:37 pm

Hi All,

When running the following test, im getting the 'NoSuchElementException' in this code line: driver.FindElement(By.LinkText("exact:Wachtwoord vergeten?")).Click();

There are no proxy servers setted in my browsers.
I also tried to set a timeout after driver.Navigate().GoToUrl(baseURL + "/Account/LogOn?"); to wait for 10 sencods before running driver.FindElement(By.LinkText("exact:Wachtwoord vergeten?")).Click();
but still not the same error.

When running the same testcase through RC, it works great.
What is going on here and how can i fix this ? please some advice.

This is my entire code



using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;

namespace SeleniumTests
{
[TestFixture]
public class Untitled
{
private IWebDriver driver;
private StringBuilder verificationErrors;
private string baseURL;

[SetUp]
public void SetupTest()
{
driver = new FirefoxDriver();
baseURL = "192.168.0.112";
verificationErrors = new StringBuilder();
}

[TearDown]
public void TeardownTest()
{
try
{
driver.Quit();
}
catch (Exception)
{
// Ignore errors if unable to close the browser
}
Assert.AreEqual("", verificationErrors.ToString());
}

[Test]
public void TheUntitledTest()
{
driver.Navigate().GoToUrl(baseURL + "/Account/LogOn");
driver.FindElement(By.LinkText("exact:Forget your password?")).Click();
}
private bool IsElementPresent(By by)
{
try
{
driver.FindElement(by);
return true;
}
catch (NoSuchElementException)
{
return false;
}
}
}
}

Djaved

Posts : 5
Join date : 2012-02-14

Back to top Go down

Re: OpenQA.Selenium.NoSuchElementException : Unable to find element

Post by zlos7ar on Thu Feb 16, 2012 11:15 pm

try driver.findElement(By.xpath("//......."))

http://wiki.openqa.org/display/SEL/Help+With+XPath

to find the XPath you need firebug and FirePath (its firebug extension mine is version 0.9.7)

zlos7ar
Amateur
Amateur

Posts : 41
Join date : 2012-01-13
Age : 28
Location : Germany

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum