Skip to content

Commit

Permalink
Bugfix: supporting sleep after get in browse command
Browse files Browse the repository at this point in the history
  • Loading branch information
englehardt committed Apr 8, 2016
1 parent 662668a commit 83b235f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions automation/Commands/browser_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,16 @@ def extract_links(webdriver, browser_params, manager_params):

sock.close()

def browse_website(url, num_links, webdriver, proxy_queue, browser_params, manager_params, extension_socket):
def browse_website(url, num_links, sleep, webdriver, proxy_queue,
browser_params, manager_params, extension_socket):
"""
calls get_website before visiting <num_links> present on the page
NOTE: top_url will NOT be properly labeled for requests to subpages
these will still have the top_url set to the url passed as a parameter
to this function.
"""
# First get the site
get_website(url, webdriver, proxy_queue, browser_params, extension_socket)
get_website(url, sleep, webdriver, proxy_queue, browser_params, extension_socket)

# Connect to logger
logger = loggingclient(*manager_params['logger_address'])
Expand All @@ -166,7 +167,7 @@ def browse_website(url, num_links, webdriver, proxy_queue, browser_params, manag
try:
links[r].click()
wait_until_loaded(webdriver, 300)
time.sleep(1)
time.sleep(max(1,sleep))
if browser_params['bot_mitigation']:
bot_mitigation(webdriver)
webdriver.back()
Expand Down
6 changes: 3 additions & 3 deletions automation/Commands/command_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def execute_command(command, webdriver, proxy_queue, browser_settings, browser_p
proxy_queue, browser_params, extension_socket)

if command[0] == 'BROWSE':
browser_commands.browse_website(command[1], command[2], webdriver,
proxy_queue, browser_params, manager_params,
extension_socket)
browser_commands.browse_website(command[1], command[2], command[3],
webdriver, proxy_queue, browser_params,
manager_params, extension_socket)

if command[0] == 'DUMP_FLASH_COOKIES':
browser_commands.dump_flash_cookies(command[1], command[2], webdriver,
Expand Down
4 changes: 2 additions & 2 deletions automation/TaskManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,9 +448,9 @@ def get(self, url, sleep=0, index=None, timeout=60, reset=False):
""" goes to a url """
self._distribute_command(('GET', url, sleep), index, timeout, reset)

def browse(self, url, num_links = 2, index=None, timeout=60, reset=False):
def browse(self, url, num_links=2, sleep=0, index=None, timeout=60, reset=False):
""" browse a website and visit <num_links> links on the page """
self._distribute_command(('BROWSE', url, num_links), index, timeout, reset)
self._distribute_command(('BROWSE', url, num_links, sleep), index, timeout, reset)

def dump_flash_cookies(self, url, start_time, index=None, timeout=60):
""" dumps all Flash LSOs to db """
Expand Down

0 comments on commit 83b235f

Please sign in to comment.