protractor

Get back the webdriver.Locator out of an elementFinder

纵饮孤独 提交于 2019-12-24 00:56:18
问题 Given I have the elmFinder variable: var elmFinder = element(by.css('.thing')); What if i need to get back the webdriver.Locator, a.k.a locator strategy? i.e. elmFinder.??? //=> by.css('.thing') I'm looking after the function ??? if it exists. UPDATE: This feature has been merged and we can now do: elmFinder.locator(); 回答1: UPDATE: This feature has been merged and we can now do: elmFinder.locator(); Old answer: You cannot. The element finder does not keep a reference to the locator: https:/

is not assignable to parameter of type 'Expected<Promise<string>>' in editor

跟風遠走 提交于 2019-12-24 00:44:40
问题 My tests are passing from command line, however I edit the typescript source using Atom . And when I open one of the test files in my editor, I'm seeing an error on this line: expect(pageObject.name.getText()).toEqual('Some name'); This is the error: Typescript Error Argument of type '"Some name"' is not assignable to parameter of type 'Expected<Promise<string>>'.at line 16 col 50 Why does this show in my editor? Yet tests pass. Command to run protractor tests: protractor dist/protractor

How do I reference a promise returned from a chained function? [duplicate]

巧了我就是萌 提交于 2019-12-24 00:37:28
问题 This question already has answers here : How do I access previous promise results in a .then() chain? (17 answers) Closed 4 years ago . I'm new to promises, and I'm not sure if I'm using them correctly. I'm trying to make a calculation with some promises, so I chained a bunch of functions together. First I wrote it like the following, which worked, but doesn't seem like good code. it('should verify CPC column', function() { ptor.findElements(protractor.By.className('aggRow')).then(function

Protractor send a scroll command to an element (div etc)

倖福魔咒の 提交于 2019-12-23 23:01:42
问题 In protractor end to end test, how can one set the scroll value of an element (e.g. div), not entire page. Something which by jQuery, one would simply call for example $('.myElement').scrollTop(100); . This is because in my end to end test, I want to test that when one particular <div> has scrolled, I want to assert that another <div> must have be scrolled to keep in sync. 回答1: selenium doesn't provide way to scroll at an element level. if the jquery code does the scrolling, then run that

Interaction between restartBrowserBetweenTests with onPrepare()

我是研究僧i 提交于 2019-12-23 22:42:17
问题 I want each of my tests to run on clean browser (Firefox) so i use restartBrowserBetweenTests:true option. Because i use non-Angular demo app, in onPrepare() function i use browser.waitForAngularEnabled(false) . It's works fine, when i run a single spec, but when i run 2 specs, i have error. Angular could not be found on the page. If this is not an Angular application, you may need to turn off waiting for Angular. How can i solve this? And in addition, how onPrepare works in this case - every

protractor get element by name tag

让人想犯罪 __ 提交于 2019-12-23 16:12:09
问题 Currently I am working with protractor and Selenium web Driver. I have the following problem: I have a html page, and I make protractor clicking a button. Then a window pops up. This window contains a text box with the Name "Description": <input type="Text" name="Description" ... /> Now when I try the following: element(by.css('[name="Description"]')).sendKeys("rabbababab"); The browser does nothing, but protractor does not throw an error. No text is typed into the TextBox. Unfortunatelly,

Unable to generate Report when using jasmine-reporters in protractor

穿精又带淫゛_ 提交于 2019-12-23 15:52:13
问题 i Used the following code in config var jasmineReporters = require('jasmine-reporters'); onPrepare: function() { browser.driver.manage().window().maximize(); browser.params.envi='DEVINT'; //For output reports jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter('./test', true, true)); }, When i ran the tests it ran successfully, but im not seeing any reports generated. Any Suggestions? 回答1: Not sure it would help but here is what is working for me: onPrepare: function () {

Protractor sendkeys not working: an x display is required for keycode conversions

北城以北 提交于 2019-12-23 11:53:44
问题 I am trying to run Protractor e2e tests inside a Vagrant VM using headless Chrome. I managed to get it working by using Xvfb but when I run a test to fill a form I get an error: unknown error: an X display is required for keycode conversions, consider using Xvfb All tests run fine but as soon as I use getKeys() (e.g. element(by.model('user.email')).sendKeys('admin'); ) I get this error, even though I am already using Xvfb. I'm running: AngularJS sample app generated with the Yeoman angular

Where to put implicitlyWait in Protractor?

荒凉一梦 提交于 2019-12-23 10:15:43
问题 If I want to use implicitlyWait , where I should put browser.manage().timeouts().implicitlyWait(5000); in the test? 回答1: Add it in the onPrepare() function of your protractor's conf.js file. The reason to add implicitlyWait() there is because implicit wait is the default time that protractor waits before passing or throwing an error for an action. Letting protractor know what the implicit wait time is, even before the tests start is the best way to make use of it and onPrepare() function runs

Protractor - invalid SSL certificate

為{幸葍}努か 提交于 2019-12-23 10:09:34
问题 We have an application and testing this locally shows an invalid SSL certificate warning. Normally I would just add an exception and get on with it. However is there anyway for protractor to ignore this? I've seen some capabilities in selenium where SSL can be ignored but can't seem to find any in protractor. 回答1: This works for me, (in conf file): capabilities: { browserName : 'firefox', marionette : true, acceptInsecureCerts : true } Hope that helps. 回答2: try webdriver-manager update -