我有(我认为)一种独特的js问题。我正在使用Protractor和Jasmine编写测试,我需要在js文件之间共享数据。有什么办法吗?我找到的所有解决方案都是针对网页的,我只使用js文件。期待您的快速回复,如果有任何信息遗漏,请告诉我,我会立即添加。 最佳答案 我自己还没有测试过,但也许你可以尝试使用以下方法将东西放在全局范围内:global.mySharedData={someKey:'somevalue'}//inoneofyourtestfilesit('shoulddosomething',function(){global
我已经用webdriver-managerstart启动了一个服务器,但是当我尝试运行Protractor时出现这个错误:Usingtheseleniumserverathttp://127.0.0.1:4444/wd/hub[launcher]Running1instancesofWebDriverERROR-UnabletostartaWebDriversession.C:\...\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:113vartemplate=newErro
我需要检查返回的数据是否按日期排序。我是这样写的:it('shouldbesortedbydate',function(){element.all(by.repeater('usersingroup.users')).then(function(users){varlastUser=users[0].element(by.id('birth-date')).getText();for(vari=1;i返回:Expected'Jan1,201500:00'tobegreaterthan'Jan1,201500:00'.我做错了什么?currentUser和lastUser似乎是对象而不是
案例我尝试测试:在Angular应用程序页面上按下按钮,将您重定向到其他网站(不是Angular应用程序)。it('shouldgoto3dpartyservicewheniclick"auth"button',function(){browser.driver.sleep(3000);element(by.id('files-services-icon')).click();element(by.id('box-vendor-menu-item')).click();browser.driver.sleep(2000);expect(browser.driver.getLocatio
我可以使用规范或套件名称作为参数来运行Protractor测试吗?我目前正在运行它:protractormyconf.js谢谢。 最佳答案 是的,有特定的--specs命令行参数:$protractor--helpUsage:protractor[options][configFile]configFiledefaultstoprotractor.conf.jsThe[options]objectwilloverridevaluesfromtheconfigfile.Options:--helpPrintProtractorhelp
我当前的单元测试(Protractor+angularJS项目)失败并出现错误UnknownError:unknownerror:Elementisnotclickableatpoint(525,1103)。我使用调试器在失败前停止它,我认为它失败的唯一原因是按钮不在视口(viewport)中(你必须向下滚动)。失败的行是homeLink=ptor.findElement(protractor.By.linkText('Home'));homeLink.click();expect(ptor.getCurrentUrl()).toBe(homeUrl);来自https://github
我正在使用Protractor(0.22.0)来测试我的应用。这可能有一个Mocha式记者而不是基本的Jasmine式记者吗?目前看起来像这样:(....F...)我看起来更像:mysetoftests1mytest1-1mytest1-2mysetoftests2mytest2-1mytest2-2 最佳答案 请在此处查看回复:CustomJasminereporterinProtractortests我正在使用这个模块,它工作得很好:https://www.npmjs.com/package/jasmine-spec-repor
普遍的网络共识似乎是,如果您在chrome模拟器中看到一个名称,您可以在Protractor配置中按原样使用它...所以我尝试了AppleiPad:{browserName:'chrome',chromeOptions:{mobileEmulation:{deviceName:'AppleiPad'}}}但我不得不四处乱逛,直到反复试验得出正确的设备名称为:AppleiPad3/4现在我在这里搜索:https://developer.chrome.com/devtools/docs/device-mode#enable-device-mode在这里:https://sites.goog
我正在使用AngularJS,我想删除一个链接,在这种情况下,会出现一个警告框以确认删除。我正在尝试使用Protractor进行端到端测试,如何在警告框中确认?我试过:browser.switchTo().alert().accept()但是好像不行。Protractor中是否有处理警告框的规定? 最佳答案 尝试browser.driver.get('URL');browser.switchTo().alert().accept();或browser.ignoreSynchronization=truebrowser.get('UR
在我的测试中,我有许多模式和下拉菜单,它们打开并自动将焦点设置在它们的输入框上。我已经看到可以断言元素处于焦点中。但是有什么快捷方式可以将键发送到当前处于焦点的元素吗?我希望能够跳过每次查找每个元素的所有工作。 最佳答案 您可以使用selenium的activeElement()特性来访问当前聚焦的元素source.例如//selectthecurrentpagecontext'sactiveelementbrowser.switchTo().activeElement().sendKeys('Test')