2013-03-26 98 views
2

我们正在使用htmlunit进行函数测试,它工作得很好。一个我所看到的问题的在建,它会生成一些警告消息:HtmlUnit为无效的css生成警告

ERROR [main] (StrictErrorReporter.java:80) - runtimeError: message=[An 
invalid or illegal selector was specified (selector: '.page-container 
.order-completed-selector[data-product-number=0022002]' error: Invalid 
selectors: .page-container 
.order-completed-selector[data-product-number=0022002]).] 
sourceName=[http://localhost/resources/scripts/lib/jquery-1.7.2.js] 
line=[5138] lineSource=[null] lineOffset=[0] 

我不知道是什么,因为它工作在浏览器级别的微小和测试也通过的确切原因。但它在我看来,它不喜欢属性[data-product-number=0022002]。有人知道可能是什么原因吗?

+1

我不知道有关的规范,但有你试过把数字放进引号中('[data-product-number =“0022002”]')?你可能对http://jigsaw.w3.org/css-validator/感兴趣。 – 2013-03-26 12:13:51

+1

谢谢...斑点。我将它改为单引号(')并且工作正常。我能不能请您将您的评论作为其他人利益的答案? – 2013-03-26 12:42:24

回答

1

你需要把成数报价:

[data-product-number='0022002'] 

(我认为两者"'应该是CSS规范是正确的。)