在使用xpath选择元素时,而页面正在重新加载时。它显示超时错误。 通过使用browser.sleep(5000即一些值),我可以使测试用例运行无误。但是,如何在需要偶数时使它适用于每个元素,而不是每次都编写浏览器。sleep
答案 0 :(得分:0)
jasmineNodeOpts: {
print: function() {},
showColors: true,
defaultTimeoutInterval: 2500000,
}
以上会议帮助您解决问题
对于隐式,始终使用量角器ExcpectedConditions(EC)
答案 1 :(得分:0)
使用browser.sleep
代替browser.wait
示例:
var EC = protractor.ExpectedConditions;
// Waits for the element with id 'abc' to be visible on the dom.
browser.wait(EC.visibilityOf($('#abc')), 5000);
有关更多详细信息,请检查https://www.protractortest.org/#/api?view=ProtractorExpectedConditions
答案 2 :(得分:0)
添加到以上答案中!
隐式等待:要等待一段时间,我们可以使用browser.sleep()
Error occurred while reading WSGI handler:
Traceback (most recent call last):
File "c:\server\MyDjangoWebApp\wfastcgi.py", line 791, in main
env, handler = read_wsgi_handler(response.physical_path)
File "c:\server\MyDjangoWebApp\wfastcgi.py", line 633, in
read_wsgi_handler
handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
File "c:\server\MyDjangoWebApp\wfastcgi.py", line 605, in
get_wsgi_handler
handler = handler()
File "c:\server\MyDjangoWebApp\venv\lib\site-
packages\django\core\wsgi.py", line 12, in get_wsgi_application
django.setup(set_prefix=False)
File "c:\server\MyDjangoWebApp\venv\lib\site-
packages\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "c:\server\MyDjangoWebApp\venv\lib\site-
packages\django\apps\registry.py", line 81, in populate
raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant
StdOut:
StdErr:
明确等待:您可以在预期条件下实现明确等待
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="DjangoIISHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="c:\server\MyDjangoWebApp\venv\Scripts\python.exe|c:\server\MyDjangoWebApp\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<add key="PYTHONPATH" value="c:\server\MyDjangoWebApp" />
<add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
<add key="WSGI_LOG" value="c:\server\MyDjangoWebApp\wfastcgi.log" />
<add key="DJANGO_SETTINGS_MODULE" value="Busisoft_Document_Extraction_Web.settings" />
<add key="WSGI_RESTART_FILE_REGEX" value=".*((\.py)|(\.config))$" />
</appSettings>
另一个优点是,只要元素可见,我们就可以使用.then进行必要的操作。
browser.sleep(3000) //waits for 3 seconds
干杯!