Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selenium opening pdf in new window
#1
Hello!
I've been trying to use Selenium as i am unable to figure requests out (kindly help me with requests here).

I am facing the following problem with selenium:
When trying to download pdf files from multiple links on the same page, it opens the pdf in a different window and throws the following error:
Error:
Message: The element reference of <a href="javascript:__doPostBack('dtgReports$ctl03$ctl01','')"> is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed
I have tried the following with no success:
profile = webdriver.FirefoxProfile()
profile.set_preference("browser.download.folderList", 2)
profile.set_preference("browser.download.manager.showWhenStarting", False)
profile.set_preference("browser.download.dir", '/home/bunni/Desktop/pat_files')
profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/pdf")
profile.set_preference("browser.helperApps.neverAsk.openFile", "")
profile.set_preference("pdfjs.disables", True)
profile.set_preference("plugin.scan.Acrobat", "99.0")
profile.set_preference("plugin.scan.plid.all", False)
profile.set_preference("browser.download.manager.useWindow", True)
profile.set_preference("plugin.disable_full_page_plugin_for_types", "application/pdf")

browser = webdriver.Firefox(firefox_profile=profile)
Can someone please help me out here?
Reply


Messages In This Thread
Selenium opening pdf in new window - by test - Sep-13-2018, 06:53 AM
RE: Selenium opening pdf in new window - by Larz60+ - Sep-13-2018, 10:23 AM
RE: Selenium opening pdf in new window - by test - Sep-13-2018, 02:08 PM
RE: Selenium opening pdf in new window - by test - Sep-14-2018, 06:54 PM
RE: Selenium opening pdf in new window - by test - Sep-15-2018, 02:14 AM
RE: Selenium opening pdf in new window - by test - Sep-15-2018, 06:17 AM
RE: Selenium opening pdf in new window - by test - Sep-15-2018, 07:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Selenium Window Not Closing gw1500se 4 2,926 May-02-2022, 02:23 PM
Last Post: gw1500se
  Web Page not opening while web scraping through python selenium sumandas89 4 10,350 Nov-19-2018, 02:47 PM
Last Post: snippsat
  Getting error when accessing elements in a modal window of an webpage using selenium sumandas89 3 8,917 Jul-13-2018, 10:44 AM
Last Post: mlieqo
  How to access Modal window using Selenium Python sumandas89 0 4,373 Mar-30-2018, 08:21 AM
Last Post: sumandas89
  Need Help Opening A New Tab in Selenium HiImNew 2 39,892 Jan-15-2018, 05:53 AM
Last Post: HiImNew
  Error in Selenium: CRITICAL:root:Selenium module is not installed...Exiting program. AcszE 1 3,818 Nov-03-2017, 08:41 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020