首页 > 解决方案 > 在 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']")

页面:在https://opensea.io/asset/create上添加项目 在此处输入图像描述

在此处输入图像描述

标签: pythonpython-3.xseleniumselenium-chromedriver

解决方案


由于浏览器最大化不适合您。

您尝试过 ActionsChains 吗?

from selenium.webdriver.common.action_chains import ActionChains
ActionChains(driver).move_to_element(browser.find_element_by_xpath("//i[@value='add']/../..")).click().perform()

推荐阅读