Created
          June 18, 2013 04:01 
        
      - 
      
- 
        Save adamgoucher/5802604 to your computer and use it in GitHub Desktop. 
    A taste of what our webinar has in store for you
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def menu(self, path): | |
| chain = ActionChains(self.driver) | |
| split_path = path.split('/') | |
| for p in split_path: | |
| # go back up? | |
| if p == '..': | |
| chain.send_keys_to_element(self._current_menu_item, Keys.ARROW_LEFT) | |
| else: | |
| e = self.driver.find_element(*locators[p.lower()]) | |
| # these are downloads | |
| href = e.get_attribute('href') | |
| ext = href[href.rfind('.') + 1:] | |
| if ext in ['pdf', 'csv', 'xls']: | |
| chain.move_to_element(e) | |
| # jquery disabled | |
| elif 'ui-state-disabled' in self.driver.execute_script('return arguments[0].parentNode.getAttribute("class");', e): | |
| chain.move_to_element(e) | |
| else: | |
| chain.click(e) | |
| chain.perform() | |
| self._current_menu_item = e | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment