From 69dc9c8985e0ee75d85c7e77bb7a8f5e775d0033 Mon Sep 17 00:00:00 2001 From: liyang Date: Mon, 27 Jan 2025 09:38:03 +0800 Subject: [PATCH] * [misc] add get main nav method in spider script. --- test/spider.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/spider.php b/test/spider.php index 736c15cad1..d6a18fe716 100755 --- a/test/spider.php +++ b/test/spider.php @@ -24,3 +24,23 @@ function getAppMenu($mainCount = 15) return $mainMenu; } + +/** + * Get all xpath of secondary menu. + * + * @param int $count + * @access public + * @return mixed + */ +function getMainNav($count = 20) +{ + $xpath = '//*[@id="navbar"]//li[%s]'; + + $menus = array(); + for($i = 1; $i <= $count; $i ++) + { + $menus[] = sprintf($xpath, $i); + } + + return $menus; +}