gpt4 book ai didi

python - Milonic 菜单 : Element is not clickable at point. 其他元素将收到点击

转载 作者:太空宇宙 更新时间:2023-11-03 16:34:53 29 4
gpt4 key购买 nike

我正在尝试自动选择 Milonic 中的项目菜单。我正在使用这样的代码:

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By

driver = webdriver.Firefox()
example_menu = driver.find_element_by_id('m_example')
example_menu.click()
# Wait for the "Example Choice" choice to appear
choice_present = expected_conditions.presence_of_element_located((By.LINK_TEXT, 'Example Choice'))
WebDriverWait(driver, 5).until(choice_present)
# Click on "Example Choice"
example_choice = driver.find_element_by_link_text('Example Choice')
example_choice.click()

但是,会引发 WebDriverException 并显示如下消息:

Element is not clickable at point (236, 44). Other element would receive the click

最佳答案

解决方案是使用 ActionChains将鼠标移到菜单条目上,但单击 Milonic链接:

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Firefox()
example_menu = driver.find_element_by_id('m_example')
example_menu.click()
# Wait for the "Example Choice" choice to appear
choice_present = expected_conditions.presence_of_element_located((By.LINK_TEXT, 'Example Choice'))
WebDriverWait(driver, 5).until(choice_present)
# Use an action chain to move to the "Example Choice" but click on the
# Milonic menu link
example_choice = driver.find_element_by_link_text('Example Choice')
mmlink1 = driver.find_element_by_id('mmlink1')
action_chain = ActionChains(driver)
action_chain.move_to_element(example_choice)
action_chain.click(mmlink1)
action_chain.perform()

关于python - Milonic 菜单 : Element is not clickable at point. 其他元素将收到点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37311157/

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