You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Selenium无法定位特定B3网站元素,寻求技术帮助

Selenium无法定位目标网站元素的问题

问题描述

访问目标网站 https://insurconnect.b3.com.br/menu-web/ctp/TelaPrincipalCetip21 时,无法使用Selenium定位元素,但在其他网站测试时功能正常。

已尝试的操作

  • 使用By.Class、Xpath、FullXpath、Css Selector等多种定位方式
  • 通过开发者工具检查,未找到元素的name或Id属性
  • 尝试用time.sleep()等待元素加载,问题仍未解决

代码示例

import pandas as pd
from selenium.webdriver.common.action_chains import ActionChains
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time  # 原代码缺少time模块导入

nav=webdriver.Edge(executable_path='C:/Users/F00010764/msedgedriver.exe') #指定webdriver路径

#Dados de acesso B3
website_b3 ="https://digital.icatuseguros.com.br/seguro-de-vida?utm_term=icatu%20seguros&utm_campaign=%5BRACC%5D%5BS%5D+Institucional&utm_source=adwords&utm_medium=ppc&hsa_acc=7589317064&hsa_cam=11999175291&hsa_grp=115633742533&hsa_ad=579263938725&hsa_src=g&hsa_tgt=kwd-1564194867&hsa_kw=icatu%20seguros&hsa_mt=b&hsa_net=adwords&hsa_ver=3&gclid=Cj0KCQiA-oqdBhDfARIsAO0TrGEnsUte5EboJEUqACTG82Xp6KFQW9QnNPV5msSmtHjNlq57oOzmFnMaAh9qEALw_wcB" #Link do site b3

nav.get(website_b3)     #访问网站
time.sleep(7)
participante_path = nav.find_element_by_xpath("/html/body/form/table/tbody/tr/td/div[2]/table/tbody/tr[2]/td[3]/input")

已知异常点

代码中实际打开的网址与目标网站不一致,这可能是导致问题的原因之一。

恳请技术人员协助解决该问题!

内容的提问来源于stack exchange,提问作者Leandro Contreiras Tavares

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 23:35:23