js-Article--current
返回整页。
我遇到的问题是:
如果js-Article--current
不是顶级元素,则查找它。
如果DesiredCapabilities desiredCapabilities = DesiredCapabilities.chrome();
desiredCapabilities.setBrowserName("chrome");
desiredCapabilities.setPlatform(Platform.ANY);
WebDriver driver = new RemoteWebDriver(new URL("http://example.com:5555/wd/hub"), desiredCapabilities);
是顶级元素,则找不到它。
为什么?
P.S。我知道解决方案:过滤而不是查找。但为什么发现这样的行为呢?我不明白。
答案 0 :(得分:0)
2015-06-24 15:03:36.592 GoogleAnalyticsDemoiOS[9540:264576] VERBOSE: GoogleAnalytics 3.12 +[GAITrackerModel initialize] (GAITrackerModel.m:88): idfa class missing, won't collect idfa
2015-06-24 15:03:36.619 GoogleAnalyticsDemoiOS[9540:264576] INFO: GoogleAnalytics 3.12 -[GAIReachabilityChecker reachabilityFlagsChanged:] (GAIReachabilityChecker.m:159): Reachability flags update: 0X000002
2015-06-24 15:03:36.644 GoogleAnalyticsDemoiOS[9540:264684] VERBOSE: GoogleAnalytics 3.12 -[GAIBatchingDispatcher persist:] (GAIBatchingDispatcher.m:517): Saved hit: {
parameters = {
"&_crc" = 0;
"&_s" = 1;
"&_u" = ".etnoKo9L";
"&_v" = "mi3.1.2";
"&a" = 800078077;
"&aid" = "com.mycompany.app";
"&an" = GoogleAnalyticsDemoiOS;
"&av" = "1.0";
"&cd" = "Detail Screen";
"&cid" = "caf03508-eba6-42f8-9600-3832ce042907";
"&dm" = "x86_64";
"&ds" = app;
"&sr" = 750x1334;
"&t" = screenview;
"&tid" = "UA-xxxxxxxx-3";
"&ul" = en;
"&v" = 1;
"&z" = 663648936779959001;
gaiVersion = "3.12";
};
timestamp = "2015-06-24 07:03:36 +0000";
}
2015-06-24 15:03:36.644 GoogleAnalyticsDemoiOS[9540:264684] VERBOSE: GoogleAnalytics 3.12 __70-[GAIBatchingDispatcher checkIAdCampaignAttributionWithHitParameters:]_block_invoke (GAIBatchingDispatcher.m:749): iAd campaign tracking disabled because the iAd framework is not linked. See http://goo.gl/426NGa for instructions.
2015-06-24 15:03:46.642 GoogleAnalyticsDemoiOS[9540:264684] VERBOSE: GoogleAnalytics 3.12 -[GAIRequestBuilder requestGetUrl:payload:] (GAIRequestBuilder.m:195): building URLRequest for https://ssl.google-analytics.com/collect
2015-06-24 15:03:46.643 GoogleAnalyticsDemoiOS[9540:264684] VERBOSE: GoogleAnalytics 3.12 -[GAIBatchingDispatcher dispatchWithCompletionHandler:] (GAIBatchingDispatcher.m:632): Sending hit(s) GET: https://ssl.google-analytics.com/collect?av=1.0&cid=caf03508-eba6-42f8-9600-3832ce042907&tid=UA-64362429-3&a=800078077&dm=x86_64&cd=Detail+Screen&t=screenview&aid=com.wow.touch&ul=en&_u=.etnoKo9L&ds=app&sr=750x1334&v=1&_s=1&_crc=0&an=GoogleAnalyticsDemoiOS&_v=mi3.1.2&ht=1435129416641&qt=10001&z=663648936779959001
2015-06-24 15:03:46.710 GoogleAnalyticsDemoiOS[9540:264576] INFO: GoogleAnalytics 3.12 -[GAIBatchingDispatcher didSendHits:response:data:error:] (GAIBatchingDispatcher.m:226): Hit(s) dispatched: HTTP status -1
2015-06-24 15:03:46.710 GoogleAnalyticsDemoiOS[9540:264684] INFO: GoogleAnalytics 3.12 -[GAIBatchingDispatcher deleteHits:] (GAIBatchingDispatcher.m:529): hit(s) Successfully deleted
2015-06-24 15:03:46.711 GoogleAnalyticsDemoiOS[9540:264684] INFO: GoogleAnalytics 3.12 -[GAIBatchingDispatcher didSendHits:] (GAIBatchingDispatcher.m:237): 1 hit(s) sent
将尝试查找选择器的子元素。因此,如果find()
是选择器,它将无法找到它。
.js-Article--current
会过滤选择器
检查控制台:
filter()

var findTest = $('div').find('#test').length;
var filterTest = $('div').filter('#test').length;
console.log('find test: ' + findTest);
console.log('filter test: ' + filterTest);