我无法访问此代码,它显示了0.000秒内的Ran 0测试
from selenium import webdriver
import unittest
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
class execute(unittest.TestCase):
def setUp(self):
chrome_options: Options = webdriver.ChromeOptions()
chrome_options.add_argument("--Person1")
chrome_options.add_argument("--start-maximized")
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('http://localhost/dashboard/user/login')
def login(self):
self.driver.find_element_by_id('uemail').send_keys('xyz@gmail.com')
self.driver.find_element_by_id('upwd').send_keys('123')
self.driver.find_element_by_id('upwd').send_keys(Keys.RETURN)
def test_method(self):
self.setUp()
self.login()
def TearDown(self):
self.driver.close()
if __name__ == "__main__":
unittest.main()
答案 0 :(得分:0)
if __name__ == "__main__":
unittest.main()
您的缩进不正确。.因此unittest.main()
将不会执行。
chrome_options: Options = webdriver.ChromeOptions()
这是无效的Python。您可能是说:
chrome_options = webdriver.ChromeOptions()