在我的Django项目上运行Selenium测试时,我开始收到错误:
selenium.common.exceptions.WebDriverException: Message: Element is not clickable at point (61, 24.300003051757812). Other element would receive the click: <a class="navbar-brand" href="#"></a>
Run Code Online (Sandbox Code Playgroud)
奇怪的是有两个原因:第一,先前通过的测试,我没有编辑代码库的那部分.其次,当弹出Selenium驱动的Firefox窗口并且我最大化页面时,测试通过.但是当我让Selenium测试在Firefox浏览器没有最大化的情况下运行时,它们会失败.
我没有使用任何花哨的javascript(只是基本的Bootstrap 3模板),只是普通的旧HTML和CSS.我在Python 3.4上使用Django 1.9.我已经运行了pip来检查Selenium的升级,而且我是最新的.
这是我的视图和模板输出的html的pastebin链接.
其中一项失败的测试是:
def test_create_task_and_check_that_it_shows_up_in_the_task_manager_index_and_filter(self):
# Create user
self.user = User.objects.get(username=test_superuser_username)
# Log the user in
self.log_user_in(user_object=self.user, password=test_superuser_password)
self.browser.implicitly_wait(10)
# Pull up the main task manager page
self.browser.get(str(self.live_server_url) + reverse('task_manager:index'))
# Make sure we go to the task manager index
task_index_url = str(self.live_server_url) + reverse('task_manager:index')
self.browser.get(task_index_url)
self.browser.implicitly_wait(4)
self.assertTrue(str(task_index_url) == self.browser.current_url,
msg=('Assertion that current_url …Run Code Online (Sandbox Code Playgroud) 我正在尝试为我的Django项目运行迁移,但是我收到错误:
AttributeError: 'ManyToManyField' object has no attribute 'm2m_reverse_field_name'
Run Code Online (Sandbox Code Playgroud)
当我在所有应用程序上运行迁移时,我没有收到任何错误.只有当我尝试实际迁移时才会这样.我无法从追溯信息中了解哪个模型正在创建问题,甚至是哪个应用程序.我看过我的模特,我看不到任何突然出现的东西.
这是堆栈跟踪:
Operations to perform:
Apply all migrations: admin, sessions, case_manager, file_manager, auth, contenttypes, tasks, people_and_property
Running migrations:
Rendering model states... DONE
Applying file_manager.0006_auto_20160109_1536...Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/mint/Python_Projects/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/home/mint/Python_Projects/venv/lib/python3.4/site-packages/django/core/management/__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/mint/Python_Projects/venv/lib/python3.4/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/mint/Python_Projects/venv/lib/python3.4/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/home/mint/Python_Projects/venv/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 200, in …Run Code Online (Sandbox Code Playgroud)