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

Selenium实现点击eljur.ru登录页机构选择框进入搜索

解决eljur.ru登录页“选择教育机构”框点击无响应问题

针对你遇到的问题,大概率是定位的元素不是实际触发点击事件的目标,或是元素未完全加载、被遮挡导致的。以下是可行的解决步骤(以Python Selenium为例):

核心解决思路

  1. 定位正确的可点击元素:页面中的“选择教育机构”是自定义下拉组件,实际可触发点击的是外层的form-select-button容器,而非你之前尝试的子元素(form-select-button--icon-left或form-select-button_placeholder)。
  2. 等待元素完全加载:避免在元素未渲染完成时触发点击,用显式等待确保元素可交互。
  3. 处理元素遮挡/JS绑定事件:如果普通点击失效,用JavaScript强制触发点击,绕过前端事件绑定的限制。

代码实现

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

# 初始化浏览器驱动
driver = webdriver.Chrome()
driver.get("https://eljur.ru/login")

# 显式等待选择框容器加载完成并可点击(超时10秒)
wait = WebDriverWait(driver, 10)
institution_select = wait.until(EC.element_to_be_clickable((By.CLASS_NAME, "form-select-button")))

# 滚动元素到视图中(避免被页面元素遮挡)
driver.execute_script("arguments[0].scrollIntoView(true);", institution_select)

# 尝试普通点击,失败则用JS强制点击
try:
    institution_select.click()
except Exception:
    driver.execute_script("arguments[0].click();", institution_select)

额外排查点

  • 如果仍无效,检查页面是否存在弹窗或遮罩层,需先关闭这些干扰元素。
  • 确认浏览器驱动版本与浏览器版本匹配,避免兼容性问题。

内容的提问来源于stack exchange,提问作者batyr new

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.18 10:19:57