瀏覽代碼

补充申报方法

1 2 周之前
父節點
當前提交
c54498ef79
共有 1 個文件被更改,包括 9 次插入0 次删除
  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()
+}