gpt4 book ai didi

python - Selenium:单击的元素,使用 xpath 识别,在 Windows 上工作正常,但在 Linux 上失败

转载 作者:行者123 更新时间:2023-12-04 19:40:00 25 4
gpt4 key购买 nike

我有一个可以在 Windows 上完美运行的 python selenium 脚本。该脚本读取下拉元素的 xpath 并单击它,显示列表中的值。当我在 Linux 上运行相同的代码时,脚本单击下拉列表但不显示列表值。事实上,我在这两个地方都使用相同的 chromedriver 版本。
我无法通过“ID”找到元素,因为它是由 javascript 动态生成的。
可能是什么问题及其解决方案?

  • 检查屏幕

  • enter image description here
  • Xpath 用户:
    (//div[text()='资源标准']//parent::div//parent::div//parent::div/div 2/div/div/div/div/div/div/div) 1
  • Windows 下拉菜单的屏幕截图
    enter image description here
  • 最佳答案

    在我根据@crissal 建议工作时关闭此线程。我使用了 CSS 选择器而不是 xpath。

    关于python - Selenium:单击的元素,使用 xpath 识别,在 Windows 上工作正常,但在 Linux 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68050348/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com