mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
定位语句中,在tag:模式下查询文本时,用text()和tx()代替text和tx,避免元素中有text或tx属性时无法定位
This commit is contained in:
parent
2b5a3ca73d
commit
cb8a7e5c11
@ -142,7 +142,7 @@ def str_to_loc(loc: str) -> tuple:
|
||||
r = re_SPLIT(r'([:=])', at_lst[1], maxsplit=1)
|
||||
if len(r) == 3:
|
||||
mode = 'exact' if r[1] == '=' else 'fuzzy'
|
||||
arg_str = 'text()' if r[0] in ('text', 'tx') else f'@{r[0]}'
|
||||
arg_str = 'text()' if r[0] in ('text()', 'tx()') else f'@{r[0]}'
|
||||
loc_str = _make_xpath_str(at_lst[0], arg_str, r[2], mode)
|
||||
else:
|
||||
loc_str = f'//*[name()="{at_lst[0]}" and @{r[0]}]'
|
||||
|
Loading…
x
Reference in New Issue
Block a user