Hot answers tagged

5

You can create an Even listener: EventListeners (NUnit 2.4.4) Interface The extension object passed to Install must implement the EventListener interface: public interface EventListener { void RunStarted( string name, int testCount ); void RunFinished( TestResult result ); void RunFinished( Exception exception ); void TestStarted(TestName ...


4

How Selenium determines whether an element exists and how it behaves when an element is not found seems to vary from one release to the next. With the current release, it is possible to finesse the problem by switching to the findElements method. For example, in Java I would do something like this: elements = driver.findElements(By.id(Element_ID")); if (...


2

My guess is that your element is not present. the Click() method using the Firefox driver doesn't work like ClickAndWait in the Selenium IDE. You must explicitly do an implicit wait before you click on something. My guess is that you had 2 clicks right in a row, and it's failing on the second click because that element doesn't exist yet, because the first ...


2

According to WebDriver API JavaDoc, if no matching elements are found then the NoSuchElementException is thrown by findElement() method, not NullPointerException. So the root cause of your problem is not a wrong XPath expression. Instead, your stacktrace and your source code suggests this is a problem with driver variable not initialized: you try to call ...


1

JMeter doesn't come with any JDBC driver shipped. Looking into stacktrace I can see that you're using Oracle and presumably 10g version. You need to download Oracle JDBC driver (or better fetch it from ORACLE_HOME/jdbc/lib, you'll need ojdbc6.jar as it matches Java 6 which is required for the latest JMeter) and drop it to /lib folder of your JMeter ...


1

When you return back to the page, page reloads and all elements become stale. For you it may look like same element (with same locator), but page is new object. So you need to fetch the elements again.


1

On the Scorex_LoginTestCases (Btw, we do not use underscore in names in Java (See conventions), the objects objLogin and objHome are not initialized. On the TestBase, you should initialize them using the PageFactory's method initElements. You can see a sample here.


1

I used a helper function to see if at least one element still exists. Because I'm finding a new element each loop, StaleElementException doesn't occur anymore. while(isElementVisible(d, (By.ClassName("search-choice-close")))) { d.FindElement(By.ClassName("search-choice-close")).Click(); TestHelper....


1

I'd recommend you to use any of the below wait methods. You may find success with any of these 3 methods, but it is always a good practice to use Explicit Wait as you are instructing the web driver to specifically look for what you need, instead of blindly waiting till the entire DOM gets loaded. Explicit Wait: (Most Preferred) WebDriverWait wait = new ...


1

The EventListener is the way to go. However there is a knack: the UnhandledException will not be fired when an Assertion in your test fails. Rather use the TestFinished event to handle failed tests: public void TestFinished(TestResult result) { if (result.Executed && result.IsFailure) { Console.WriteLine(string.Format("Failure in ...


1

You can also follow this procedure. First, copy your web-element in to a variable of type web-element: webelement elem=driver.findElement(By.id("elementid")); Now make the action by elem.click(); When DOM element changes, the id will not be same as the stack, so when a click action given after the element identification it will again check for the same ...



Only top voted, non community-wiki answers of a minimum length are eligible