Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 正在等待页面加载非语言站点_Angularjs_Selenium_Selenium Webdriver_Protractor - Fatal编程技术网

Angularjs 正在等待页面加载非语言站点

Angularjs 正在等待页面加载非语言站点,angularjs,selenium,selenium-webdriver,protractor,Angularjs,Selenium,Selenium Webdriver,Protractor,我的测试正在进行…有点。。。 问题是,有时它会找到元素,有时却找不到。我假设页面加载得稍晚一些。我需要增加一些等待时间。我不知道如何将工作与非角网站 这是有效的部分…嗯,大约有50%的时间 browser.driver.findElement(By.xpath("//button[.='Log In']")).submit(); 这就是我试图做的 browser.driver.wait(function() { expect(browser.driver

我的测试正在进行…有点。。。 问题是,有时它会找到元素,有时却找不到。我假设页面加载得稍晚一些。我需要增加一些等待时间。我不知道如何将工作与非角网站

这是有效的部分…嗯,大约有50%的时间

browser.driver.findElement(By.xpath("//button[.='Log In']")).submit();
这就是我试图做的

        browser.driver.wait(function() {
            expect(browser.driver.findElement(By.xpath("//button[.='Log In']"))).isPresent().toBe(true);
        });
        browser.driver.findElement(By.xpath("//button[.='Log In']")).submit();
这是我得到的堆栈

Using the selenium server at http://localhost:4444/wd/hub
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
The last active task was: 
WebDriver.sleep(50000)
    at [object Object].webdriver.promise.ControlFlow.timeout (/Library/WebServer/Documents/youman/test/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1358:15)
    at [object Object].webdriver.WebDriver.sleep (/Library/WebServer/Documents/youman/test/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/webdriver.js:600:21)
    at [object Object].<anonymous> (/Library/WebServer/Documents/youman/test/spec/craiglist.js:56:24)
    at /Library/WebServer/Documents/youman/test/node_modules/protractor/node_modules/jasminewd/index.js:94:14
    at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/Library/WebServer/Documents/youman/test/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1640:20)
    at [object Object].webdriver.promise.ControlFlow.runEventLoop_ (/Library/WebServer/Documents/youman/test/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1505:8)
    at [object Object].wrapper [as _onTimeout] (timers.js:252:14)
    at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
F

Failures:

  1) Craigslist automation should greet the named user
   Message:
     timeout: timed out after 10000 msec waiting for spec to complete
   Stacktrace:
     undefined

Finished in 11.073 seconds
1 test, 2 assertions, 1 failure

Asims-MacBook-Air:test asimzaidi$ ./node_modules/.bin/protractor  protractor.conf.js
Using the selenium server at http://localhost:4444/wd/hub
F

Failures:

  1) Craigslist automation should greet the named user
   Message:
     Error: expect called with WebElement argument, expected a Promise. Did you mean to use .getText()?
   Stacktrace:
     Error: expect called with WebElement argument, expected a Promise. Did you mean to use .getText()?
    at Error (<anonymous>)
==== async task ====
    at [object Object].<anonymous> (/Library/WebServer/Documents/youman/test/spec/mytest.js:56:24)
==== async task ====
Asynchronous test function: it()
Error
    at [object Object].<anonymous> (/Library/WebServer/Documents/youman/test/spec/craiglist.js:13:5)
    at Object.<anonymous> (/Library/WebServer/Documents/youman/test/spec/mytest.js:10:1)

Finished in 9.707 seconds
使用位于的selenium服务器http://localhost:4444/wd/hub
茉莉花规格超时。重置WebDriver控制流。
上一个活动任务是:
WebDriver.sleep(50000)
在[object object].webdriver.promise.ControlFlow.timeout(/Library/WebServer/Documents/youman/test/node_modules/dragrator/node_modules/selenium webdriver/lib/webdriver/promise.js:1358:15)
在[object object].webdriver.webdriver.sleep(/Library/WebServer/Documents/youman/test/node_modules/dragrator/node_modules/selenium webdriver/lib/webdriver/webdriver.js:600:21)
在[对象]。(/Library/WebServer/Documents/youman/test/spec/craiglist.js:56:24)
at/Library/WebServer/Documents/youman/test/node_modules/dragrator/node_modules/jasminewd/index.js:94:14
在[object object].webdriver.promise.ControlFlow.runInNewFrame(/Library/WebServer/Documents/youman/test/node_modules/dragrator/node_modules/selenium webdriver/lib/webdriver/promise.js:1640:20)
在[object object].webdriver.promise.ControlFlow.runEventLoop(/Library/WebServer/Documents/youman/test/node_modules/dragrator/node_modules/selenium webdriver/lib/webdriver/promise.js:1505:8)
在[object object].wrapper[as\u onTimeout](timers.js:252:14)
at Timer.listOnTimeout[as onttimeout](timers.js:110:15)
F
失败:
1) Craigslist automation应该欢迎指定用户
信息:
超时:等待规格完成10000毫秒后超时
堆栈跟踪:
未定义
以11.073秒完成
1次测试,2次断言,1次失败
Asims MacBook Air:测试asimzaidi$./node_modules/.bin/dragotor-dragor.conf.js
使用位于的selenium服务器http://localhost:4444/wd/hub
F
失败:
1) Craigslist automation应该欢迎指定用户
信息:
错误:使用WebElement参数调用expect,应为承诺。您是想使用.getText()吗?
堆栈跟踪:
错误:使用WebElement参数调用expect,应为承诺。您是想使用.getText()吗?
错误()
==异步任务====
在[对象]。(/Library/WebServer/Documents/youman/test/spec/mytest.js:56:24)
==异步任务====
异步测试函数:it()
错误
在[对象]。(/Library/WebServer/Documents/youman/test/spec/craiglist.js:13:5)
反对。(/Library/WebServer/Documents/youman/test/spec/mytest.js:10:1)
以9.707秒完成

我在测试时遇到了类似的问题。我必须通过多次运行测试来找出测试的最佳等待时间。另外,我增加了specs:jasmineNodeOpts:{defaultTimeoutInterval:20000}的超时时间间隔,希望这对您有所帮助!是否忽略浏览器同步<代码>browser.ignoreSynchronization=true