schickling / chromeless

🖥 Chrome automation made simple. Runs locally or headless on AWS Lambda.
https://chromeless.netlify.com
MIT License
13.25k stars 575 forks source link

fix: load event not fired when page load very fast (fix #277, #297) #400

Closed zaaack closed 6 years ago

zaaack commented 6 years ago

Chromeless is awesome! It's much easier to use compare to puppeteer / chromedriver.

But I found it might be stuck when the page is loaded very fast. According to examples in chrome-remote-interface's README, it might be caused by register load event callback after Page.navigate, because the page could be already loaded if a page is loaded very fast. I tested in my case, the fast page load event is fired with this patch.

Also, we cannot set a timeout for page load event, so I added an optional timeout parameter in goto method.

Here are some relevant issues: https://github.com/graphcool/chromeless/issues/277 https://github.com/graphcool/chromeless/issues/297

codecov-io commented 6 years ago

Codecov Report

Merging #400 into master will increase coverage by 1.11%. The diff coverage is 85.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #400      +/-   ##
==========================================
+ Coverage   38.03%   39.14%   +1.11%     
==========================================
  Files           7        7              
  Lines         844      866      +22     
  Branches      116      121       +5     
==========================================
+ Hits          321      339      +18     
- Misses        523      527       +4
Impacted Files Coverage Δ
src/api.ts 47.71% <100%> (ø) :arrow_up:
src/chrome/local-runtime.ts 27.27% <100%> (+0.83%) :arrow_up:
src/util.ts 43.97% <78.94%> (+2.52%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fcdc8dc...221ef45. Read the comment docs.

felixfbecker commented 6 years ago

:tada: This PR is included in version 1.5.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: