Skip to content

Commit

Permalink
Update scraper.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandhunt committed Jan 27, 2020
1 parent 81be96c commit 71a61a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scraper.py
Expand Up @@ -293,7 +293,7 @@ def doeshtmlelementexist(selectedel):
childrenCount = len(products)
childrenCountNew = childrenCount
if scrapsite['scrapefield']['phantomjsimport'] == 'phantomjsimport_scroll_loadmore_wait':
browser.execute_script("window.scrollTo(0, -document.body.scrollHeight);")
browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(scrollTime)
while childrenCount == childrenCountNew:
if onlyScrollDown is False:
Expand All @@ -309,7 +309,7 @@ def doeshtmlelementexist(selectedel):
childrenCountNew = len(products)
exists = doeshtmlelementexist(temp_root.cssselect(scrapsite['scrapefield']['productloadmoreselector'])) if onlyScrollDown is False else False
if scrapsite['scrapefield']['phantomjsimport'] == 'phantomjsimport_scroll_loadmore_wait':
browser.execute_script("window.scrollTo(0, -document.body.scrollHeight);")
browser.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(scrollTime)
new_scrollheight = browser.execute_script("return document.body.scrollHeight")
if new_scrollheight == cur_scrollheight:
Expand Down

0 comments on commit 71a61a0

Please sign in to comment.