1

以下是该元素在页面上的外观:

在此处输入图像描述

我想要在通用工程课程之后的所有li常规[COURSE_NAME]课程也是其他页面上的常用文本。

所以基本上我想要GENERAL [COURSE_NAME] Courses之后的所有li

我编写了以下 XPath,但不幸的是,它在 Chrome 上执行 XPath 时导致了 DOMException。

//*[starts-with(text(), 'GENERAL') and ends-with(text(), 'COURSES')]

在此处输入图像描述

页面:http ://catalog.fullerton.edu/content.php?catoid=16&navoid=1922

4

1 回答 1

0

您需要使用 XPath Axes,以下兄弟

//p[starts-with(strong,'GENERAL ') and substring(strong, string-length(strong)-7)=' COURSES']/following-sibling::ul/li
于 2019-09-11T13:46:38.803 回答