2

I have written a simple program to mimic logging into a web page, clicking on a few options and the final step is to click on a link to generate a report. Everything seems to be running fine on my PC and the report actually get downloaded into the default download directory(I am using Chrome). However, when my colleague tried it, the file download was cut off and the browser process terminates itself running the same code and I can't seem to replicate what he saw. My code looks like this:

browser = splinter.Browser('chrome')    
browser.visit('https://village-us.albourne.com/castle/')
browser.fill('username','xxx')
browser.fill('password','xxxxx')
browser.find_by_name('signinform')
button = browser.find_by_name('submit_0')
button.click()

browser.visit('https://village-us.albourne.com/castle/hf/listingoptions')
rptButton = browser.find_by_name('buildReport')
rptButton.click()
browser.find_by_name('checkbox_0').click()
browser.find_by_name('checkbox_1').click()
excelButton = browser.find_by_id('excelReport').first
excelButton.click()

So my questions are: 1. Is the excelButton.click() response supposed to be synchronized to the browser's response(per default timeout of course)? 2. Is there a way to change the default timeout period? 3. Since the browser is getting opened, if we run this process as a batch process, will this pose any issue when the screen lock is on? I have read about using the zope-testbrowser which seems like a good alternative for this purpose, but not sure if zope-testbrowser supports file downloads as well.

Phil M
  • 93
  • 1
  • 4

0 Answers0