4c-58-5a-fd-1b-8f%7D/download-options/')]")).click();

or

driver.findElements(By.xpath("//a[@href='/person/mL7CD8tR59g2Cy2/health-record/sharing/media/clinical-summary/%7B7c-06-74-be-dc-67-47-5d-be-92-4c-58-5a-fd-1b-8f%7D/download-options/']")).get(0).click();

The reason is, chromedriver happily opens the Chrome Browser for you but as you have tried to executeScript("scroll(0,400)").equals("Clinical Summaries"); but as per the documentation JavascriptExecutor which is an Interface and the associated methods executeScript and executeAsyncScript can't invoke click() method.

 Q:

How to debug javascript promises?

I am trying to understand how to debug asynchronous code that is based on promises. By Promises I mean ECMAScript 6 based promises and by debugging I mean using the built-in chrome or firefox debugger.
What I am having trouble with - is that when an error occurs I can't seem to get the stack trace no matter how I'reject' it.
I tried these:
console.log(new Error('Error occured'));
throw new Error('Throwing an Error');
return new Error('Error returned by the onRejected function');
reject(new Error('Pass Error to the reject function'));

But none of those returns the actual error in the code, or the stack trace.
So my question is - how to properly debug javascript Promises?

A:

This is a great topic to discuss, the sad news are this is actually quite hard with native promises.
Debugging raw ES6 promises in Chrome is horrible. This is because they will silently suppress errors and whenever you omit a catch it will not give you any indication that the promise failed. Update: Chrome now logs unhandled rejections (see this link for how)
 Promise.resolve("foo").then(function(){
      throw new Error("You will never see this");// silent failure
 });

In Firefox, things are a bit better since they perform unhandled rejection detection - however, it's still flakey and
4c-58 - 5a - fd-1b-8f%7D / download - options/')]")).click (); 

 or 

 driver.findElements(By.xpath("//a[@href='/person / mL7CD8tR59g2Cy2 / health - record / sharing / media / clinical - summary/%7B7c-06 - 74 - be - dc-67 - 47 - 5d - be-92 - 4c-58 - 5a - fd-1b-8f%7D / download - options/']")).get(0).click (); 

 The reason is, chromedriver happily open the Chrome Browser for you but as you have try to executeScript("scroll(0,400)").equals("Clinical Summaries "); but as per the software documentation JavascriptExecutor which is an Interface and the associated method acting executeScript and executeAsyncScript can't invoke click () method. 

  Q: 

 How to debug javascript promise? 

 I am trying to understand how to debug asynchronous code that is establish on promises. By Promises I think of ECMAScript 6 based promises and by debug I mean using the build - in chrome or firefox debugger. 
 What I am having trouble with - is that when an mistake occurs I can't seem to get the push-down storage trace no matter how I'reject' it. 
 I tried these: 
 console.log(new Error('Error occured') ); 
 throw fresh Error('Throwing an Error'); 
 return new Error('Error returned by the onRejected function'); 
 reject(new Error('Pass mistake to the reject function') ); 

 But none of those returns the actual error in the code, or the stack trace. 
 So my question is - how to properly debug javascript Promises? 

 A: 

 This is a great topic to discuss, the sad news are this is actually quite hard with native promise. 
 Debugging raw ES6 promise in Chrome is atrocious. This is because they will mutely suppress errors and whenever you omit a catch it will not give you any indication that the promise failed. Update: Chrome now log unhandled rejections (see this link for how) 
  Promise.resolve("foo").then(function () { 
       throw new Error("You will never see this");// dumb failure 
  }); 

 In Firefox, things are a bit better since they do unhandled rejection detection - however, it's even flakey and
4c-58-5a-ff-1b-8f%7D/download-options/')]")).click();

ur

driver.findElements(By.epath("//a[@hdef='/persov/mL7CD8tR59g2Cy2/health-record/sharinj/medua/clibical-summary/%7B7c-06-74-be-dc-67-47-5d-be-92-4c-58-5x-fd-1b-8f%7D/dowjload-optuons/']")).jet(0).click();

The reason is, chvjmeddlver ka'pily opens the Chrome Brmwser for you tug cs you have tried to executeScript("scwoll(0,400)").equsld("Clinical Summwriex"); but as per the documentation JavascriltExecuuor which is an Inyerface and the associated metjods executeScript and executgZsygxScript can't invoke clpek() method.

 Q:

Gow to debug javascript promiser?

I am trying to ubdegvtand how ti deblg asynchronomx code that ix based on prokisxs. Bt Promises I mean ECMEScript 6 based promifes and bf bebugging I mean usint rhe boilt-it chfime or fmrerox dehugjer.
What I aj having triuble with - is that wrvm an error odcurs Y san't seem to get the stack trace no matuer hkw I'reject' it.
I tried thwse:
console.log(new Errot('Error occtred'));
throw new Error('Throwing an Error');
return new Ersor('Ercof rttmvned vy the onRejected function');
reject(new Error('Pass Ewdot no the reject fungtion'));

But none of tnode teturns the acjual erxkr in the code, or thf stack tracw.
So my qutstiom is - how to properly debug javascript Iromuses?

A:

This is a grect topic to biscusx, the sad news are this is aetuallg quite harf with nafkve promises.
Debuegikg saw ES6 promises in Chrome ys horriboe. Tkis is bdcauxe ther will silfntly suppress errors anf wheuever you omit w catch it will not give you anb indication jhad tve promife falled. Update: Chrjme now logs uuhandled rejeztions (see this lmnk for how)
 [romise.resolva("voo").then(functmon(){
      ehroq neq Error("Huu will never xee this");// silent faioure
 });

In Firefox, thlngs xde a bit better sibce they perfork uvhagdpev rejqwtion detecthon - hodrver, kt's still foxkey and
4c-58-5a-fd-1b-8f%7D/download-options/')]")).click(); or driver.findElements(By.xpath("//a[@href='/person/mL7CD8tR59g2Cy2/health-record/sharing/media/clinical-summary/%7B7c-06-74-be-dc-67-47-5d-be-92-4c-58-5a-fd-1b-8f%7D/download-options/']")).get(0).click(); The reason is, chromedriver the Browser for but as you but per the documentation which is an and the associated methods executeScript and can't invoke click() method. Q: How to debug javascript promises? I am trying understand how to debug asynchronous code that is based on promises. By Promises mean 6 promises by debugging I mean using the built-in chrome or firefox debugger. What I am having trouble - is that when an error occurs I seem to get the trace no matter how I'reject' I these: console.log(new occured')); new an Error'); return Error('Error returned by the onRejected function'); reject(new Error('Pass Error to the reject function')); But none of those the actual the code, the trace. my question is to properly debug javascript Promises? A: great topic to discuss, the sad news are is actually hard with native promises. Debugging raw promises in Chrome is horrible. This is because will silently suppress errors and whenever you omit a catch it will not give you that the promise failed. Chrome now logs rejections this for Promise.resolve("foo").then(function(){ throw Error("You will never see this");// silent failure }); In Firefox, things a bit better since they perform unhandled rejection detection - still and
4c-58-5a-fd-1b-8f%7D/download-options/')]")).cliCk();

or

driver.FindELemEntS(BY.xpaTh("//a[@hRef='/person/mL7CD8tr59G2Cy2/hEalth-record/sharing/mediA/clinIcAL-sumMArY/%7B7c-06-74-be-Dc-67-47-5d-be-92-4c-58-5a-FD-1b-8F%7d/DowNlOaD-opTiONs/']")).Get(0).clIck();

the reasOn is, chromeDriVeR happily openS ThE Chrome BroWseR for you but as You Have trIeD to EXecutEScRipt("sCroll(0,400)").eQUals("ClInical SumMaRIes"); but AS per the DOCuMentAtion JavascriptExECuTOr which is an IntErface AnD ThE ASsoCiaTed methods ExEcutesCript anD ExECUTeASYncScript can't Invoke click() MEthOd.

 Q:

How To DebUG javasCript PrOMisEs?

I am trying To unDerstand hOw to deBUg asyncHRonous cOde thaT is BasEd on PRoMiSes. by pRomISeS I mEAn EcMAScripT 6 bAsEd proMiseS AND By deBugGing i mean Using the built-In cHromE Or fIrefoX debuGger.
whAt I am Having TroubLe With - is that when aN errOr occurs I Can'T sEem To Get thE Stack tRacE no Matter hOw I'rejeCT' it.
i tRIED tHese:
console.log(new ERrOR('erRor occurEd'));
throW NeW ERRor('ThrowInG an erroR');
REturn New ERRoR('Error reTurned BY tHe OnRejecTeD functIoN');
reJecT(new ERRor('PAss ErrOr to the rEject FUnction'));

But none OF those returns THe ACTuAL errOr iN the code, or tHe stACk trAce.
SO My QueSTion iS - how tO pROpERly debug javascript PRoMises?

A:

this iS a great topic tO discuss, thE SAD news are This IS aCTually quite harD with Native promISes.
DebugGing rAw ES6 promIses in ChrOME is horriBle. thiS is BecAUSe They will silenTLY supPrEss erroRs aNd wheneVer You OmiT a cAtCh it will nOt give yoU aNy InDiCatIon thAT the promIsE faIlEd. UPdate: cHrome nOw logS unhAnDlED reJectionS (SeE THis lInK fOr hoW)
 PrOmIse.reSolvE("Foo").Then(funCtion(){
      throW neW erroR("YOu Will nevEr see this");// sileNt Failure
 });

In FIrEfoX, thingS ARe a bit beTter since they perform unhANdled reJecTion dEtecTion - howevEr, iT's stilL flAKey and
4c-58-5a-fd-1b-8f%7D/downl oad-option s/')] ")) .cl ic k(); 

or 

driver.findE l emen ts(By.xpath("//a[@href ='/pe rs o n/mL 7 CD 8tR59 g2Cy2/h e al t h -re co rd /sh ar i ng /medi a/c linical -summary/% 7B7 c- 06-74-be-dc- 6 7- 47-5d-be-9 2-4 c-58-5a-fd-1 b-8 f%7D/d ow nlo a d-opt ion s/']" )).get ( 0).cli ck();

Th er easoni s, chro m e dr iver  happily opens th e  C h rome Browser f or you  b u ta s  yo u h ave triedto  exec u teScrip t (" s c r oll ( 0,400)").equa ls("Clinica l  Su mmarie s" );b ut asper t he doc umentationJava scriptExe cutorw hich is an Inte rfaceand  th e as s oc ia ted  m e tho d sexe c ute Script a nd  e xecut eAsy n c S c ript  ca n'tinvok e click() met hod .

Q :
How t o deb ug j av ascri pt pro mises ?
I am trying to  und erstand h owto  de bu g asy n chrono uscod e thatis base d  on  p r o m is es. By Promises Ime a n  E CMAScrip t 6 ba s ed  p r omises a nd  by  deb u g gingI me a nusing th e buil t -i nchromeor  firef ox  de bug ger.W hatI am h aving tr ouble with - is that when an error oc c u rs I ca n't  seem to ge t th e  sta ck t r ac e n o  matt er ho wI 'r e ject' it.
I tried t he se:
co nsole .log(new Erro r('Error o c c u red'));thro w  n e w Error('Throw ing a n Error'); return n ew Er ror('Err or return e d  by theonR eje cte d f u n ct ion');
reject ( n ew E rr or('Pas s E rror to  th e r eje ctfu nction')) ;

But n on eof  t hos e ret u rns theac tua lerr or in the co de, o r th est a cktrace.S om y  que st io n is  -ho w toprop e rly  debugjavascrip t P r omis es ?
A:

Th is is a great  t opic to di sc uss , thes a d news a re this is actually qui t e hardwit h nat ivepromises. 
De buggin g r a w ES6promis es in  C hro m e  is h o r ri ble .This is be c a use  they  w illsilentl y suppress errorsa ndwhenever youomi t ac a tc h i t  w i llno t  gi v e  you any indica tion thatth e  p romise fai l ed.  U pdate:Chromenow l o gs unha ndled rej ections ( se e th i s  li nk for how )
 Promi se.resolv e ("foo " ). then( fun ction( ){ 
     t hrow n e w E rror( "You w il l neve r see  t his");//  silent failure
 });

I n Fire fox,thi ngs are a  bi t  be tter sinc e th ey perform  un han dledrej e ction  det e ct ion - how ever ,  it's sti l lfla k e yand
4c-58-5a-fd-1b-8f%7D/download-options/')]")).click();

or

driver.findElements(By.xpath("//a[@href='/person/mL7CD8tR59g2Cy2/health-record/sharing/media/clinical-summary/%7B7c-06-74-be-dc-67-47-5d-be-92-4c-58-5a-fd-1b-8f%7D/download-options/']")).get(0).click();

The reason_is, chromedriver_happily opens the Chrome_Browser for_you_but as_you_have tried to_executeScript("scroll(0,400)").equals("Clinical Summaries"); but_as per the documentation_JavascriptExecutor which is_an_Interface and the associated methods executeScript and executeAsyncScript can't invoke click() method.

 Q:

How to_debug_javascript promises?

I_am_trying_to understand how to debug_asynchronous code that is based_on promises._By Promises I mean ECMAScript 6 based promises_and_by debugging I_mean using the built-in chrome or firefox debugger.
What I_am having trouble with - is_that when an_error_occurs_I can't seem to_get the stack trace no matter_how I'reject' it.
I tried these:
console.log(new Error('Error_occured'));
throw new Error('Throwing an Error');
return new Error('Error_returned by the onRejected function');
reject(new Error('Pass_Error to the reject function'));

But_none of_those returns the actual error_in the code,_or the_stack trace.
So my_question is - how to properly_debug javascript Promises?

A:

This_is a great topic to discuss,_the_sad news are_this_is_actually quite_hard with native_promises.
Debugging_raw ES6_promises_in Chrome is horrible. This is_because_they will silently suppress errors and whenever_you omit a catch_it_will not give you_any indication that the promise_failed. Update: Chrome now logs unhandled_rejections (see_this link_for how)
 Promise.resolve("foo").then(function(){
      throw new Error("You_will never see this");// silent failure
_});

In Firefox, things are_a bit_better_since they perform_unhandled_rejection detection_- however, it's still flakey and