我试图通过元素“tr”的xpath迭代表行搜索。但是当我试图找到元素“td”来迭代它们并获取文本时,我得到了错误“invalid locator”。这只是个测试,有人能帮我吗?代码如下:
from RPA.Browser.Selenium import Selenium
lib = Selenium()
lib.open_available_browser("https://ge.globo.com/futebol/brasileirao-serie-a/")
lib.wait_until_element_is_visible('xpath://*[@id="classificacao__wrapper"]/article/section[1]/div/table[2]/tbody/tr')
trs = lib.find_elements('xpath://*[@id="classificacao__wrapper"]/article/section[1]/div/table[2]/tbody/tr')
for tr in trs:
td = tr.find_elements('tag:td')
print(td)
好吧,我找到答案了。RPAFramework的python文档非常混乱,在模块“webelement”中搜索时,我发现“find_elements”方法不起作用。我需要替换为“按标签名称查找元素”。下面是代码:
相关问题 更多 >
编程相关推荐