Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8496113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:45:42+00:00 2026-06-10T23:45:42+00:00

Update 2 I am working on .Net using C# with the control called GridView…

  • 0

Update 2

I am working on .Net using C# with the control called GridView… so gridview control renders and spit this html something like this: this is just an one small sample html source one TR I have like 100s of that…

<tr class="item">
<td align="center">
<td align="center" style="width:15px;"/>
<td>John John</td>
<td/>
<td>Friendship</td>
<td/>
<td>
<td>9/7/2012 6:28:29 PM</td>
</tr>

so, I am trying to find if John John exists and here is how i am end-up using the XPATH

        int pageCount = 100;
        bool assertFlag = false;
        for (int i = 0; i < pageCount; i++) 
        {
            try
            {
                string _Id = String.Format("//*[@id='ctl00_ContentPlaceHolder1_AddeCardControl1_gridview_control']/tbody/tr[{0}]/td[3]", i);
                string _txt = GetText(By.XPath(_Id));

                if (_txt == "some text comparing here")
                {
                    //matched
                    assertFlag = true;
                    break;
                }
            }
            catch (Exception e)
            {
                //
            }
        }

What do you think guys? or am I making something horrible terrible wrong?

PS: there is no ID or CSS selector I can do so I have no other options other than using the XPATH

END UPDATE 2

UPDATE

I am using Selenium WebDriver 2 with C# and I am using IE 8 and FF

END UPDATE

I am still not sure what causes this error to be thrown so i have script and it works and when i run the second time it fails and get the below message… and if i keep running more than once then sometimes it works and sometimes not… what should i do? what causes this error? any insight?

sometimes I get this error message:

Element is no longer valid

sometimes this:

Unable to find element with xpath == //*[@id='ctl00_ctl00_ctl00_LeftNavigation_LeftNavigation_LeftNavigationControl1_rptLeftNav_ctl14_lnkText']
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:45:44+00:00Added an answer on June 10, 2026 at 11:45 pm

    I think your last question; Getting Timeout using Selenium Webdriver had a lot of good stuff. That was relevant to the question you’re asking. If you can’t find an element using one type of locator, try another type.

    I also couldn’t help but notice you were using an xpath locator for IE. There is a really good webinar of why you should never use xpath in IE (and in general) due to speed issues, this might be causing some of your current issues.

    Here is the link: http://sauceio.com/index.php/2011/05/why-css-locators-are-the-way-to-go-vs-xpath/ . The webinar investigates why CSS is superior to xpath especially with IE. CSS aside, the errors you’re getting can be caused by anything though from your box settings to the browser you’re using, web automation is not an exact science after all. Hell you could have a bug as well…isn’t that what you’re testing for in the first place?

    EDIT

    So your updates are a little strange to me because you totally switched from looking for multiple elements under something with an individual id to looking for an element in a tag. In regard to your current update I would suggest just using the css locator saying

    driver.FindElement(By.CssSelector("td:contains('John John')"))
    

    If your tag can’t be found you will doubtless be told. As I mentioned earlier, css locators accomplish the same thing as xpath, but they are faster and work better in IE. Yes they do not work 100% of the time. Maybe for 5 times out of 100 you need to use xpath over css but overall css is superior. Please read the relevant links if you are still unsure of how to utilize them, they are well written and were very helpful for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on asp.net application and I have an update panel like this:
I am facing a strange problem when using the gridview control in ASP.NET. I
I've started working with ASP.net AJAX (finally ☺). and I've got an update panel
Update: Got this working by disabling CodeIgniter Profiler which was interfering with the Ajax
UPDATE: This is the working example. First we create a class to hold weekday,
My team is currently working on a substantial update to an existing ASP.NET 3.5
Im working on a web project in ASP .NET MVC 2. In this project
I'm currently working on a web app/game using C# and ASP.NET(3.5). However, I'm running
I built custom ASP.NET control and it's working fine when I add it manually
We have a button that saves asynchronously using AjaxToolKit/C#/.NET. I'm getting this in my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.