Python中文
首页
教程
问答
标签
搜索
登录
注册
在Python中找不到元素
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我试图进入曼联的主场,但不可能进入。 .<a href="https://www.flashscore.com/team/manchester-united/ppjDR086/results/" rel="nofollow noreferrer">Here is the website page</a></p> <p>下面是HTML页面的一段代码:</p> <pre><code><div id="g_1_l2dtbMED" title="Click for match detail!" class="event__match event__match--static event__match--last event__match--oneLine"><div class="event__time">04.10. 17:30</div><div class="event__participant event__participant--home"><svg class="card___2ip_DLm icon--redCard icon--redCard-first icon--redCard-last"><title></title><use xlink:href="/res/_fs/build/symbols.f1bc6b2.svg#card"></use></svg>Manchester Utd</div><div class="event__scores fontBold"><span>1</span>&nbsp;-&nbsp;<span>6</span></div><div class="event__participant event__participant--away fontBold">Tottenham</div><div class="event__part">(1&nbsp;-&nbsp;4)</div><span class="wld wld--l" title="Loss">L</span></div> </code></pre> <p>我要搜索解析的结果是'L',位于应答器<code><span></code>中</p> <p>下面是我为尝试解析它所做的代码:</p> <pre><code>driver = webdriver.Chrome() url = "https://www.flashscore.com/team/manchester-united/ppjDR086/results/" driver.get(url) Team = 'manchester Utd' results = WebDriverWait(driver, 20).until(EC.find_elements((By.XPATH,"//div[@class='event__participant--home' and contains(text(),'"+ Team +"')]//ancestor::div/span"))) print(len(results)) </code></pre> <p>但这在20秒后给我抛出了一个异常“TimeoutException”,这是搜索的时间限制</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>试试这个xpath-</p> <pre><code>//div[contains(text(),'Manchester Utd')]/following-sibling::span </code></pre>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
当pandas中出现小数据时,DataFrame.resample()被调用时,内存不足
2 回答
当Pandas中存在许多条件时,如何过滤数据?
6 回答
当pandas中没有公共列名时,我们应该如何组合多个数据集而不在行或列中重复
3 回答
当pandas中的值为null时,不使用pandas的to_列表
1 回答
当Pandas中的值和条目匹配时,如何计算键的计数?
1 回答
当pandas列中有字符串时,如何从该列获取最长长度的string/integer/float
4 回答
当pandas列重命名创建列名重复时该怎么办
1 回答
当Pandas在带有颜色标签的多个子图中创建散点图时,无法设置xlabel
3 回答
当pandas导入openpyxl模块时,该模块没有属性''uuuversion''
2 回答
当pandas数据在python中聚合时,如何计算每组尾部的sum | mean |中值
9 回答
当Pandas数据头以列(如xls)拆分时,如何读取Pandas数据头
5 回答
当Pandas数据帧包含nan时,用“新信息”更新Pandas数据帧
7 回答
当pandas是imp时,Cx\u freeze TypeError只能使用numpy依赖项将list(而不是“NoneType”)连接到list
1 回答
当Pandas满足一定条件时,如何放弃整个群体
3 回答
当Pandas的时间增量指数不规则时,如何获得时间序列值的日差?
1 回答
当Pandas通过read\u csv方法读取大文件时。IOError:[Errno 13]权限被拒绝
1 回答
当panda列有空值时,如何将其转换为int?
8 回答
当param=''时使用Beautiful Soup访问属性的参数
7 回答
当paramiko抛出“无现有会话”异常时,标准输入流挂起
2 回答
当parentchild在同一端口上监听时会发生什么?
2 回答