我用Scala的2.10,Specs2 13.1快照和Play2框架2.1提供的FluentLenium API。
我有这行代码在我IntegrationSpec
文件,找到一个子元素(根据FluentLenium规格):
browser.find(".myClass").find("#mySubElement") must haveSize(1)
该行导致以下编译错误:
error: type mismatch;
found : org.fluentlenium.core.domain.FluentList[_ <: org.fluentlenium.core.domain.FluentWebElement]
required: org.fluentlenium.core.domain.FluentList[?0(in value $anonfun)] where type ?0(in value $anonfun) <: org.fluentlenium.core.domain.FluentWebElement
Note: org.fluentlenium.core.domain.FluentWebElement >: ?0, but Java-defined class FluentList is invariant in type E.
You may wish to investigate a wildcard type such as `_ >: ?0`. (SLS 3.2.10)
它是一种...不相容性斯卡拉/ Java的,由于仿制药? 或者一个正常的行为,我没有搞清楚?
这条线然而(忽略任何匹配),以及编译:
browser.find(".myClass").find("#mySubElement")