Some months ago, I wanted to know how to click on a particular link in a page by its name, no the XPath:
Selenium IDE: Click on a particular item by name (not the XPath)
AutomatedTester helped me providing these 2 solutions:
xpath=//span[text()='Keith Duggan: Sideline Cut']
css=span:contains('Keith Duggan: Sideline Cut')
Both of them worked fine, but for my Test Cases I've decided using the second approach (using CSS) because it's very easy. However, this code doesn't work anymore.
In the last days, when trying to execute this TC I'm getting this error:
[error] Unexpected Exception: message -> window.Sizzle is not a function, fileName -> chrome://selenium-ide/content/selenium/scripts/htmlutils.js, lineNumber -> 2203, stack -> eval_css("span:contains('Keith Duggan: Sideline Cut')",[object XPCNativeWrapper])@chrome://selenium-ide/content/selenium/scripts/htmlutils.js:2203 ("span:contains('Keith Duggan: Sideline Cut')",[object XPCNativeWrapper]开发者_高级运维,[object XPCNativeWrapper])@chrome://selenium-ide/content/selenium/scripts/selenium-browserbot.js:1925 ("css","span:contains('Keith Duggan: Sideline Cut')",[object XPCNativeWrapper],[object XPCNativeWrapper])@chrome://selenium-ide/content/selenium/scripts/selenium-browserbot.js:1247 ("css","span:contains('Keith Duggan: Sideline Cut')",[object XPCNativeWrapper],[object XPCNativeWrapper])@chrome://selenium-ide/content/selenium/scripts/selenium-browserbot.js:1379 ([object Object],[object XPCNativeWrapper])@chrome://selenium-ide/content/selenium/scripts/selenium-browserbot.js:1406 ("css=span:contains('Keith Duggan: Sideline Cut')")@chrome://selenium-ide/content/selenium/scripts/selenium-browserbot.js:1417 ("css=span:contains('Keith Duggan: Sideline Cut')","")@chrome://selenium-ide/content/selenium/scripts/selenium-api.js:230 ("css=span:contains('Keith Duggan: Sideline Cut')","")@chrome://selenium-ide/content/selenium/scripts/htmlutils.js:60 ([object Object],[object Object])@chrome://selenium-ide/content/selenium/scripts/selenium-commandhandlers.js:310 ()@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:112 (0)@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:78 (0)@chrome://selenium-ide/content/selenium/scripts/htmlutils.js:60 , name -> TypeError
Any idea of what's happening here? Has Selenium introduced changes in the CSS sintaxis?
Thanks for your help
}Panacea{
There was a bug in 1.0.8 that caused that. Update to 1.0.10 and all should be well. (1.0.9 had a different nasty bug.)
What version of Selenium are you using? In recent releases the CSS selector engine was swapped out with Sizzle (the library powering jQuery), mostly for licensing reasons, but also for technical advantages. It looks like Sizzle doesn't support that particular syntax.
精彩评论