我在selenium中找不到变量值的值

2024-09-28 05:28:17 发布

您现在位置:Python中文网/ 问答频道 /正文

在BeautifulSoup中,我能够找到必要的填充字段和value变量的值

with open("output.html", encoding= 'UTF-8') as a file:
src = file.read ()
# print (src)

soup = beautiful soup(src, "lxml")

res=soup.findAll(class_= "src-components-Spoiler-Spoiler-module_ _ content")
for me in res:
name_id ="Package Nd fl 3. payload.sheet B. sources[0].the name of the source of income"
if I.I will find( id=name_id)!= No:
print(i.find( id=name id)['value']) # company

但不可能在硒中找到这一领域。 请告诉我如何正确地做

res= driver.find_elements_by_class_name("src-components-Spoiler-Spoiler-module__content")
name_id ="Ndfl3Package.payload.sheetB.sources[0].incomeSourceName"
# print((res))
lenres= len(res)
for i in range(lenres):
  print(res[i].find_element_by_id(id=name_id))

Tags: namesrcidforvaluecomponentsrescontent

热门问题