【发布时间】:2021-08-27 06:49:43
【问题描述】:
在这个问题上需要帮助。我研究过的所有解决方案/建议都无法解决。
尝试使用 Selenium 单击按钮。不断收到这些错误。
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable: [object HTMLButtonElement] has no size and location
和selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
我不明白为什么这个元素不可交互。
play_button = driver.find_element_by_xpath('//*[@id="ppp"]/div/div[2]/div[2]/div[2]/button')
driver.implicitly_wait(10)
ActionChains(driver).move_to_element(play_button).click(play_button).perform()
打印时play_button = <selenium.webdriver.remote.webelement.WebElement (session="ca50b37ee2e4b194b2ad5305e254079f", element="78e35dc3-fef8-4082-a6e4-0a92dfbf2ec6")>
我已经尝试过WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="ppp"]/div/div[2]/div[2]/div[2]/button'))),但这会超时。元素永远不会变成可点击的。
我尝试过使用完整的 xpath。
我已尝试禁用扩展/最大化窗口驱动程序选项。
元素不在框架或任何东西中。它位于身体中的 div 中。 该元素可在 Chrome 的控制台中点击。
任何信息/建议都会有所帮助。 谢谢。
【问题讨论】:
-
我已经建议了一些答案,但如果你能分享页面链接会更好
标签: python selenium selenium-chromedriver