I am writing a test script in selenium webdriver (selenium 2.0) with C# for below HTML:

    <table id="A_switch" class="tabswitch">
    <div id="A"  class="page ribbonpage">
    <div id="B" class="ribbongroup">

When i click in above table applied CSS for above and get replaced like below-

    <table id="A_switch" class="tabswitch selected">
    <div id="A" class="page ribbonpage selected">
    <div id="B" class="ribbongroup">

In this test script, after clicking on this table I am finding and clicking on <div id="B”>

Everything is working fine in Visual Studio debug mode only. When I am running it without breakpoint (release mode) sometimes "invisible element" exception and sometimes ‘timeout’ appears.

When I searched over google it looks very generic error and should be fixed with below code -

    WebDriverWait waittime = new WebDriverWait(driver, TimeSpan.FromSeconds(60));         
    var element = waittime.Until(ExpectedConditions.ElementIsVisible(By.XPath("//div[@id=’B’]/div[2]")));
    Actions act = new Actions(driver);

It is not working in my case and also, no luck if increase timeout.

Could somebody help me on the same as soon as possible?

  • Try using thread.sleep between actions. Mar 23, 2015 at 4:23
  • Post your original code and exception. Also complete your description of the problem. It ends abruptly with "after clicking on this table i am finding and clicking on". Clicking on what? Mar 23, 2015 at 20:06
  • 1
    When you're running the test, in release mode, are you sure that the div you're clicking on is visible? Mar 27, 2015 at 10:59
  • Can you please some exception and code here. And also elaborate question. What you exactly want to perform with this code.
    – Sagar007
    May 30, 2015 at 7:01

1 Answer 1


Several things I notice:

  1. Are you sure the element is, in fact, visible when in release mode?

  2. Are you storing a reference to div B before you click on div A? If the code deletes and re-creates div A, your old reference to div B won't be valid anymore. Try doing a find just before you need to click on div B.

  3. Why are you using Actions in the middle of your code there? What problem is that attempting to solve? element.click() will act as though the element was clicked on; you don't have to simulate the mouse moving unless the underlying page is concerned with the mouse moving. It will click in the right place on its own.

  4. You're waiting for the second div inside div B to be visible instead of waiting for div B to be visible. If there is no second div inside div B, this will fail.

  5. Why are you storing the result of your wait and then clicking on that? Shouldn't you be using a find() instead?

  • This doesn't look like an answer, it looks like a request for clarification. Feb 24, 2016 at 13:01
  • It was meant to be more a checklist of things to try Feb 24, 2016 at 13:44
  • You might want to consider a slight re-wording, to keep it from being closed by a moderator. For example, that first sentence could be something like "to debug a problem like this, there are several things you can try:..." Feb 24, 2016 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.