【发布时间】:2021-01-11 11:20:04
【问题描述】:
我有一个代码假设“鼠标悬停”元素的第一层,然后单击执行“鼠标悬停”操作时出现的元素的第二层。如果我执行下面的代码,它总是向我显示一个错误 'NoSuchElementException: Message: Unable to locate element: .e'。请帮助理解我做错了什么。
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
def select_random_sentence_to_delete(self):
self.driver = webdriver.Firefox()
self.driver.get('http://todomvc.com/examples/react/#/')
action = ActionChains(self.driver);
firstLevelMenu = self.driver.find_element(By.CLASS_NAME, "view"[2])
action.move_to_element(firstLevelMenu).perform()
secondLevelMenu = self.driver.find_element(By.CLASS_NAME, "destroy"[2])
action.move_to_element(secondLevelMenu).perform()
secondLevelMenu.click() ```
【问题讨论】:
标签: python selenium selenium-webdriver nosuchelementexception