Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
Djaved
Posts : 5
Join date : 2012-02-14

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

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;
}
}
}
}
avatar
zlos7ar
Amateur
Amateur
Posts : 41
Join date : 2012-01-13
Age : 36
Location : Germany

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

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)
Back to top
Permissions in this forum:
You cannot reply to topics in this forum