python - 在 python 上使用 Selenium 查找按钮
问题描述
我正在尝试从此按钮检索数据,但它引发以下错误:selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable。
按钮源代码:
<button class="Blockreact__Block-sc-1xf18x6-0 Buttonreact__StyledButton-sc-glfma3-0 bqHBns jFqMrE ActionButtonreact__StyledButton-sc-7jpoey-0" type="button"><div class="Blockreact__Block-sc-1xf18x6-0 Flexreact__Flex-sc-1twd32i-0 olSpy jYqxGr"><i value="add" size="24" class="Iconreact__Icon-sc-1gugx8q-0 irnoQt material-icons">add</i></div></button>
我的代码:
browser.find_element_by_xpath("//button[@type='button']")
解决方案
由于浏览器最大化不适合您。
您尝试过 ActionsChains 吗?
from selenium.webdriver.common.action_chains import ActionChains
ActionChains(driver).move_to_element(browser.find_element_by_xpath("//i[@value='add']/../..")).click().perform()
推荐阅读
- python - QTableView 与 QWidget 作为 QStyledItemDelegate
- javascript - 使用节点js在mongodb模式中保存数组类型值
- typescript - 如何使用角度嵌套对象制作树结构数据
- sql - Postgres - 将分组的行合并为一行以进行插入
- undefined - 未定义现代化者
- php - Laravel/PHP8:如何在存储库上键入创建的输入
- javascript - 如何让 JS 突出显示文本?
- javascript - Accordion 不会改变图标的状态
- cloud - 如何在 PCF Auto Scalar 中配置应用程序实例级别的规则?
- javascript - Firebase v9,无法从嵌套集合中获取文档