Quellcode durchsuchen

补充申报方法

1 vor 2 Wochen
Ursprung
Commit
c54498ef79
1 geänderte Dateien mit 9 neuen und 0 gelöschten Zeilen
  1. 9 0
      common/rod_utils.go

+ 9 - 0
common/rod_utils.go

@@ -595,3 +595,12 @@ func DataFormat(data string) string {
 	}
 	return data
 }
+
+// 返回当前元素下一个元素的text 如果没有元素就直接返回空
+func MustNext2Text(page *rod.Page, xpath string) string {
+	x := MustElementXV(page, xpath)
+	if x == nil {
+		return ""
+	}
+	return x.MustNext().MustNext().MustText()
+}