title: Failed- Path too long error while downloading file in Chrome using selenium
body: <p>I want to download file in my current working directory using selenium automation. But I am getting 'Path too long' error. The code I have written so far is:</p>
  
  <pre><code>os.chdir(os.path.dirname(__file__))
  current_directory = os.getcwd()
  windows_cwd = current_directory.replace('\\','\\\\')+'\\\\'
  
  chrome_options = webdriver.ChromeOptions()
  prefs = {'download.default_directory': windows_cwd,
           'download.directory_upgrade': True,
           'safebrowsing.enabled': False,
           'safebrowsing.disable_download_protection': True
           }
  chrome_options.add_experimental_option('prefs',prefs)
  
  browser = webdriver.Chrome(options=chrome_options)
  </code></pre>
  
  <p>My current working directory is: </p>
  
  <blockquote>
    <p>C:\Users\US177\PycharmProjects\Plugin</p>
  </blockquote>
  
  <p>where the path is too long.</p>
  
  <p>But it successfully downloads to </p>
  
  <blockquote>
    <p>C:\Users\US177\Desktop</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/1lrYx.png" rel="nofollow noreferrer">failed-long path</a></p>