You can obtain Firefox's current user agent from a script using various methods. Here's one common approach using a JavaScript snippet in the browser's developer console:
1. Open Firefox.
2. Press `Ctrl+Shift+I` or `Cmd+Option+I` (on macOS) to open the Developer Tools.
3. Navigate to the "Console" tab.
4. In the console, you can execute JavaScript to get the user agent. Type the following command and press Enter:
```javascript
navigator.userAgent
```
This will return the current user agent string for your Firefox browser.
If you need to access the user agent from a script outside of the browser, you can use browser automation tools like Selenium, Puppeteer, or WebDriver. Here's an example using Python and Selenium:
1. Install Selenium:
```bash
pip install selenium
```
2. Use the following Python script:
```python
from selenium import webdriver
# Start a Firefox browser instance
browser = webdriver.Firefox()
# Get the user agent
user_agent = browser.execute_script("return navigator.userAgent")
# Close the browser
browser.quit()
print(user_agent)
```
When you run this script, it will open Firefox, retrieve the user agent, and print it to the console. Make sure you have the Firefox browser and the GeckoDriver (Selenium driver for Firefox) installed and configured for this to work.
These methods allow you to obtain the current user agent from Firefox using a script, whether it's from within the browser or through automation.