简体   繁体   English

如何获取硒中元素的每个子元素?

[英]how to get each child of an element in selenium?

I'm trying to get each game of this betting website ( https://www.winamax.fr/paris-sportifs/live ) I've tried several things on selenium but I only managed to get the div with all the games combined, what I need is to get each row of games individually with their respective values我正在尝试获取该博彩网站 ( https://www.winamax.fr/paris-sportifs/live ) 的每场比赛 我已经在 selenium 上尝试了几件事,但我只设法将所有游戏组合在一起,我需要的是用各自的值分别获取每一行游戏

Then I want to get each value sorted to a variable from the real time data:然后我想从实时数据中将每个值排序为一个变量:

  • block x (x for number of games)块 x(x 代表游戏数量)
  • match (team1 and team 2)比赛(第一队和第二队)
  • score (team1 score and team2 score)得分(team1 得分和team2 得分)
  • time时间
  • odds (team1 odd and team2 odd)赔率(团队 1 奇数和团队 2 奇数)

my code:我的代码:

matchs=browser.find_elements_by_xpath('//[@id="appinner"]/div/div[1]/span/div/div[2]/section/div/div[1]/div/div')
for items in matchs:
    print(items.text)

but i don't get each game separately, only the whole block, any help will be appreciated但我没有单独获得每场比赛,只有整个街区,任何帮助将不胜感激

If you search from the network panel you will find a json endpoint that has all that data.如果您从网络面板进行搜索,您将找到一个包含所有数据的 json 端点。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM