Skip to content

Commit

Permalink
find page next button correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
rangat committed Mar 4, 2019
1 parent c11e89a commit b7192d5
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions solScrape.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,14 @@ def getData(phrase, key, context, log, start_at = None):

#nextButton = driver.find_element_by_css_selector('//*[@id="resort"]/table/tbody/tr/td/a[6]') #//*[@id="resort"]/table/tbody/tr/td/text()[6] //*[@id="resort"]/table/tbody/tr/td/a[7]

nextButton = driver.find_element_by_xpath('//*[@id="resort"]/table/tbody/tr/td/a[6]')
log.info("|"+nextButton.text+"|")
if not (nextButton.text=='> '):
log.success("Switched > element")
nextButton = driver.find_element_by_xpath('//*[@id="resort"]/table/tbody/tr/td/a[7]')
nextButton = driver.find_element_by_xpath('//*[@id="resort"]/table/tbody/tr/td/a[1]')
i = 1
while(True):
nextButton = driver.find_element_by_xpath('//*[@id="resort"]/table/tbody/tr/td/a[{}]'.format(i))
if ('>' in nextButton.text):
log.success("Switched > element")
break
i += 1

log.info(time.strftime('%a %H:%M:%S'))
nextButton.click()
Expand Down Expand Up @@ -185,11 +188,14 @@ def getData(phrase, key, context, log, start_at = None):

#nextButton = driver.find_element_by_css_selector('//*[@id="resort"]/table/tbody/tr/td/a[6]') #//*[@id="resort"]/table/tbody/tr/td/text()[6] //*[@id="resort"]/table/tbody/tr/td/a[7]

nextButton = driver.find_element_by_xpath('//*[@id="resort"]/table/tbody/tr/td/a[6]')
log.info("|"+nextButton.text+"|")
if not (nextButton.text=='> '):
log.success("Switched > element")
nextButton = driver.find_element_by_xpath('//*[@id="resort"]/table/tbody/tr/td/a[7]')
nextButton = driver.find_element_by_xpath('//*[@id="resort"]/table/tbody/tr/td/a[1]')
i = 1
while(True):
nextButton = driver.find_element_by_xpath('//*[@id="resort"]/table/tbody/tr/td/a[{}]'.format(i))
if ('>' in nextButton.text):
log.success("Switched > element")
break
i += 1

log.info(time.strftime('%a %H:%M:%S'))
nextButton.click()
Expand Down

0 comments on commit b7192d5

Please sign in to comment.