Nick Kahn
Nick Kahn

Reputation: 20078

Unable to find element in IE but in FF it works fine

EDIT:

my CSSSelector is like this: (which is working fine in FF)

for (int i = 1; i < _count; i++)
{
    ..................
    ..................
    div#ctl00_ContentPlaceHolder1 table.gv tbody tr.item:nth-child(" + i + ") > td:nth-of-type(3)
    ..................

}

EDIT END

I'm using Selenium 2.29 and IE (8) and FF (17.1) in FF all my test cases passed and when I run in IE majority of my test cases failed and here is the error message:

Test method threw exception: 
OpenQA.Selenium.WebDriverTimeoutException: Timed out after 30 seconds ---> OpenQA.Selenium.NoSuchElementException: 
Unable to find element with css selector == 

div#ctl00_ContentPlaceHolder1 table.gv tbody tr.item:nth-child(1) > td:nth-of-type(3)

I'm using CSSSelector.

do I have to change the CSSSelector for IE to work?

Upvotes: 1

Views: 669

Answers (3)

BadgerAndK
BadgerAndK

Reputation: 44

Since IE8 doesn't support :nth selectors try injecting Sizzle. Sizzle (the selector engine jQuery uses) comes with a built-in :nth-child() selector, but lacks an :nth-of-type() selector. Try replacing your :nth-of-type with :nth-child

Upvotes: 0

Louis Ricci
Louis Ricci

Reputation: 21086

CSS nth-of-type is not supported in IE8

Upvotes: 0

Marc B
Marc B

Reputation: 360682

As per: http://www.quirksmode.org/css/contents.html#t38

IE8 and below don't support the :nth selectors.

Upvotes: 6

Related Questions