获取行 self.driver.executes_script 错误self.driver.executes_script("arguments[0].click();", new_notification) AttributeError: 'WebDriver' object has no attribute 'executes_script' None但它们是一个类名import unittestfrom selenium import webdriverfrom selenium.webdriver.common.keys import Keysimport HtmlTestRunnerimport timeclass Environment(unittest.TestCase): def setUp(self): self.driver = webdriver.Chrome(executable_path="F:\\automation\\chromedriver.exe") # login test case def test_first_page_login(self): driver = self.driver driver.maximize_window() driver.get("http://localhost/dashboard/user/login") self.driver.find_element_by_id('uemail').send_keys('xyz@abc.com') self.driver.find_element_by_id('upwd').send_keys('1234567890') self.driver.find_element_by_id('upwd').send_keys(Keys.RETURN) # login page going def test_going_notification_page(self): self.test_first_page_login() time.sleep(5) going_noti_page = self.driver.find_element_by_class_name('caret') print(self.driver.execute_script("arguments[0].click();", going_noti_page)) new_notification = self.driver.find_element_by_class_name('fa-paper-plane') self.driver.executes_script("arguments[0].click();", new_notification) time.sleep(5) def tearDown(self): self.driver.quit()if __name__ == "__main__": unittest.main(testRunner=HtmlTestRunner.HTMLTestRunner(output='F:\\automation\\reports'))
添加回答
举报
0/150
提交
取消