@@ -2751,11 +2751,13 @@ def get_pdf_text(self, pdf, page=None, maxpages=None,
2751
2751
raise Exception ("%s is not a PDF file! (Expecting a .pdf)" % pdf )
2752
2752
file_path = None
2753
2753
if page_utils .is_valid_url (pdf ):
2754
+ from seleniumbase .core import download_helper
2755
+ downloads_folder = download_helper .get_downloads_folder ()
2754
2756
if nav :
2755
2757
if self .get_current_url () != pdf :
2756
2758
self .open (pdf )
2757
2759
file_name = pdf .split ('/' )[- 1 ]
2758
- file_path = self . get_downloads_folder () + '/' + file_name
2760
+ file_path = downloads_folder + '/' + file_name
2759
2761
if not os .path .exists (file_path ):
2760
2762
self .download_file (pdf )
2761
2763
elif override :
@@ -2926,10 +2928,19 @@ def save_data_as(self, data, file_name, destination_folder=None):
2926
2928
page_utils ._save_data_as (data , destination_folder , file_name )
2927
2929
2928
2930
def get_downloads_folder (self ):
2929
- """ Returns the OS path of the Downloads Folder.
2930
- (Works with Chrome and Firefox only, for now.) """
2931
- from seleniumbase .core import download_helper
2932
- return download_helper .get_downloads_folder ()
2931
+ """ Returns the OS path of the "downloads/" folder.
2932
+ Chromium Guest Mode overwrites the path set by SeleniumBase. """
2933
+ sys_plat = sys .platform
2934
+ chromium = False
2935
+ if self .browser in ("chrome" , "edge" , "opera" ):
2936
+ chromium = True
2937
+ if chromium and self .guest_mode and "linux" not in sys_plat and (
2938
+ not self .headless ):
2939
+ # Guest Mode (non-headless) can force the default downloads path
2940
+ return os .path .join (os .path .expanduser ('~' ), 'downloads' )
2941
+ else :
2942
+ from seleniumbase .core import download_helper
2943
+ return download_helper .get_downloads_folder ()
2933
2944
2934
2945
def get_path_of_downloaded_file (self , file ):
2935
2946
""" Returns the OS path of the downloaded file. """
0 commit comments