请多多包涵,我是 Python 和 Webdriver 的新手,但是在函数内部时我无法让 ActionChains 工作。
运行这个很好: -
wait.until(ec.presence_of_element_located((By.XPATH, "//*[@id='bulk-upload-patient-spreadsheet']/div[1]/div/div/div/table/tbody/tr[2]/td[1]"))).click()
actions = ActionChains(driver)
actions.send_keys("test")
actions.perform()
..但是运行它会导致错误:-
def test_function(self):
wait = initialisation.wait_for(self.driver)
self.driver = login.default_login(self.driver)
wait.until(ec.presence_of_element_located((By.XPATH, "//*[@id='bulk-upload-patient-spreadsheet']/div[1]/div/div/div/table/tbody/tr[2]/td[1]"))).click()
actions = ActionChains(self.driver)
actions.send_keys("test")
actions.perform()
我得到的错误是: -
AttributeError: 'NoneType' object has no attribute 'w3c'
任何帮助将不胜感激...