[英]How to avoid getting `'NoneType' object has no attribute 'path'` on selenium quit()?
[英]selenium testing with django gives 'NoneType' object has no attribute 'path'
我看不到发生此错误的原因,因为它没有给我更多信息。 测试通过,但是它们将此消息打印到控制台。 我将在下面发布我的文件。
tests.py:
class MainAppTests(LiveServerTestCase):
"""Testing the interactions on the main page"""
def setUp(self):
"""Opening the browser"""
selenium_logger = logging.getLogger('selenium.webdriver.remote.remote_connection')
# Only display possible problems
selenium_logger.setLevel(logging.ERROR)
self.browser = webdriver.Firefox()
self.user = make_user()
def tearDown(self):
"""Closing the browser"""
self.browser.quit()
def test_homepage(self):
"""Testing that everything work"""
self.browser.get(self.live_server_url)
self.assertIn("Site", self.browser.title)
views.py:
def home(request):
"""View for displaying the home page"""
if request.user.is_authenticated():
# Pulling and ordering by the 'full_name' field, shows users what is available
active_languages = Language.objects.filter(active=True).order_by('full_name')
context = {'active_languages': active_languages}
return render(request, 'main/home_loggedin.html', context)
return render(request, 'main/home_loggedout.html', status=302)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.