1. a:nth-of-type(1)和a:nth-child(1)的区别:
前者无视类型,只要是a下面的子元素,即一一列出,而后者列出的子元素类型一致。但两者相同点都是前一个元素必须唯一。
2. JsonNode中 path() 和 get() 的区别:
private static String getJsonValue(JsonNode nodesToSearch, String fieldName) {
JsonNode targetNode = nodesToSearch.path(fieldName);
return StringUtils.defaultIfBlank(targetNode.textValue(), null);
}
nodesToSearch.path(fieldName);找不到时返回targetNode = missingNode,可用targetNode.isMissingNode() == true判断, targetNode.textValue() == null。
nodesToSearch.get(fieldName);找不到时返回NULL。
3. 页面等待代码
waitForCondition("selenium.browserbot.getUserWindow().$.active == 0;", pageTimeout);
waitForCondition("(selenium.browserbot.getCurrentWindow().document.readyState=='interactive') || " + "(selenium.browserbot.getCurrentWindow().document.readyState=='complete');", pageTimeout);
4. Selenium Grid
CMD:
java -jar selenium-server-standalone-2.39.0.jar -role node -hub http://10.10.55.55:3737/grid/register -port 6666
Maven:
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<failIfNoTests>false</failIfNoTests>
<forkCount>1</forkCount>
<resuseForks>false</resuseForks>
<argLine>-Dfile.encoding=UTF-8</argLine>
<systemProperties>
<property>
<name>net.sourceforge.cobertura.datafile</name>
<value>target/cobertura/cobertura.ser</value>
</property>
</systemProperties>
</configuration>