python - 在 selenium python 中,我只点击第二个按钮,假设有 3 个相同的按钮
问题描述
所以我正在自动化一个过程,一个网页上有 3 个相同的按钮。但是,我只想单击第二个按钮。反正我能做到吗?
这是按钮的代码”:
expandButtons = driver.find_elements_by_xpath("//div[@class='expand-collapse']")
解决方案
expandButtons[1].click
将单击第二个按钮。
推荐阅读
- c++ - 我应该如何修复 valgrind 的未初始化值错误?
- python-3.x - ImportError:File.so 未定义符号:PyInterpreterState_GetID
- apache - 我怎样才能在 Typo3 v 9.5 的 Page TS Config 中写入一些东西?由于某种原因无法编辑
- c# - 尝试在 Discord 中使用变量作为超链接降价
- python - PyQt - 轻松将 QWidget 添加到所有视图
- python - python - 按不同类别标记单元测试:单元、集成、“dangerous_integration”
- python - 用复根写了我自己的二次公式,在验证结果时,它不给零。如何解决?
- instagram - 按标签接收所有帖子并实时获取更新喜欢
- java - 是否可以在 java 中自动化 ffmpeg-normalize?
- haskell - 计算小写和大写,然后将其作为元组返回