How To Disable Autocomplete In Firefox Using Selenium With Python?
I am building an automated test task with Selenium. When I put the first field on a form, the rest of it is autocompleted based on previous attempts. I can clear the fields to hand
Solution 1:
The best option is to create a profile for Firefox which you use with the selenium webdriver:
Start Firefox with the '-p' option to start the profile manager and create a new custom profile.
In the options you can disable the autocomplete:
Go to 'options' > 'privacy' > 'use custom settings for history' and disable 'remember search and form history.
Use the following to use the custom Firefox profile with selenium:
from selenium import webdriver
from selenium.webdriver.firefox.webdriverimportFirefoxProfile
profile = FirefoxProfile(path_to_my_profile)
driver = webdriver.Firefox(profile)
Or you can create a temporary custom profile with selenium itself (omit 'path_to_my_profile') and add the following preference:
profile.set_preference('browser.formfill.enable', False)
Solution 2:
You need to set browser.formfill.enable
firefox profile preference to false
to ask Firefox not to remember and autofill form input values:
profile.set_preference("browser.formfill.enable", "false")
Post a Comment for "How To Disable Autocomplete In Firefox Using Selenium With Python?"