Bird
0
0

Identify the issue in this Selenium Python Firefox profile setup for downloading files:

medium📝 Debug Q7 of 15
Selenium Python - Advanced Patterns
Identify the issue in this Selenium Python Firefox profile setup for downloading files:
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_preference('browser.download.folderList', 2)
profile.set_preference('browser.download.dir', '/home/user/downloads')
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'application/pdf')
profile.set_preference('browser.download.manager.showWhenStarting', false)
profile.set_preference('pdfjs.disabled', true)
AThe 'browser.download.dir' path should be an absolute path string, which it is.
BNo issues; the code correctly configures Firefox profile for auto-download.
CThe 'pdfjs.disabled' preference should be set to false to disable PDF viewer.
DThe 'browser.download.folderList' value should be a string '2', not an integer 2.
Step-by-Step Solution
Solution:
  1. Step 1: Check 'browser.download.folderList'

    Value 2 (integer) is correct to specify a custom folder.
  2. Step 2: Verify 'browser.download.dir'

    Must be an absolute path string; '/home/user/downloads' is valid.
  3. Step 3: Validate 'pdfjs.disabled'

    Setting it to true disables built-in PDF viewer, which is correct for auto-download.
  4. Step 4: Identify the bug

    All preferences are correctly set; no bug present.
  5. Final Answer:

    No issues; the code correctly configures Firefox profile for auto-download. -> Option B
  6. Quick Check:

    Integer 2 is valid for folderList, path is absolute, PDF viewer disabled [OK]
Quick Trick: Integer 2 is valid for folderList; path must be absolute [OK]
Common Mistakes:
  • Using string '2' instead of integer 2 for folderList
  • Setting pdfjs.disabled to false instead of true
  • Using relative path for download.dir

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes