1

I'm coming from a Java+Selenium environment, so maybe this is a mismatch of understanding that I'm having with Javascript/Angular/Protractor. I used to use IntelliJ's IDEA IDE for automation testing. I could actively do live search and on the fly testing of ideas using IDEA's Evaluate Expression functionality. I could actively look for elements on a page (searching using CSS selectors for instance) and do a click (or see what the text is), and if my test was in debug mode it would do the click on the page.

I was really hoping for a similar experience with WebStorm since it's IntelliJ's answer for Javascript development. I'm in the middle of debugging a Protractor UI test and I can't look at the result of a getText() without doing a .then() clause and a console.log in the .then() clause. I feel like if I do element.getText() in the Evaluate Expression tool I should be able to see what that Promise will evaluate to without having to do a then clause that resolves the Promise. I understand there's stuff having to do with the asynchronous nature of Javascript that requires the resolution of the Promise, but I would think this super smart IDE would have resolution stuff built in. Is there a way to setup WebStorm to say 'hey, resolve this for me and let me see what happens!"? I would hope for getting the same behavior when I evaluate element.click().

2

I think the closest thing to what you are asking about is "Elementor" library and a WebStorm plugin:

  • install elementor
  • run webdriver-manager start local selenium server
  • run elementor https://yourUrlHere
  • install Elementor plugin in WebStorm

Now, you should be able to test your locators from inside the WebStorm or from the Chrome window opened by Elementor.

For example, this is what I can do now (see how the text value is resolved):

enter image description here


You can also use the available Protractor debugging tool. For instance, you can put browser.enterRepl() before a desired line and then test your locators and expressions in the command prompt. Also see:

  • This is exactly what I was looking for! I was searching for it backwards, trying things like "webstorm evalutor protractor" didn't bring up any of this. Thanks so much for the extended explanation. – S.Huston Oct 17 '17 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.