Skip to content

Commit a3ae794

Browse files
committed
Fix autofill issues
1 parent 86feac4 commit a3ae794

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ def _set_chrome_options(
236236
chrome_options.add_argument("--disable-infobars")
237237
chrome_options.add_argument("--disable-save-password-bubble")
238238
chrome_options.add_argument("--disable-single-click-autofill")
239+
chrome_options.add_argument(
240+
"--disable-autofill-keyboard-accessory-view[8]")
239241
chrome_options.add_argument("--disable-translate")
240242
chrome_options.add_argument("--homepage=about:blank")
241243
chrome_options.add_argument("--dns-prefetch-disable")
@@ -300,6 +302,7 @@ def _create_firefox_profile(
300302
profile.set_preference("app.update.auto", False)
301303
profile.set_preference("app.update.enabled", False)
302304
profile.set_preference("app.update.silent", True)
305+
profile.set_preference("browser.formfill.enable", False)
303306
profile.set_preference("browser.privatebrowsing.autostart", True)
304307
profile.set_preference("devtools.errorconsole.enabled", False)
305308
profile.set_preference("dom.webnotifications.enabled", False)
@@ -797,6 +800,8 @@ def get_local_driver(
797800
edge_options.add_argument("--disable-infobars")
798801
edge_options.add_argument("--disable-save-password-bubble")
799802
edge_options.add_argument("--disable-single-click-autofill")
803+
edge_options.add_argument(
804+
"--disable-autofill-keyboard-accessory-view[8]")
800805
edge_options.add_argument("--disable-translate")
801806
if not enable_ws:
802807
edge_options.add_argument("--disable-web-security")

seleniumbase/fixtures/base_case.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,9 @@ def update_text(self, selector, text, by=By.CSS_SELECTOR,
307307
if not self.demo_mode and not self.slow_mode:
308308
self.__scroll_to_element(element, selector, by)
309309
try:
310-
element.clear()
310+
element.clear() # May need https://stackoverflow.com/a/50691625
311+
backspaces = Keys.BACK_SPACE * 42 # Is the answer to everything
312+
element.send_keys(backspaces) # In case autocomplete keeps text
311313
except (StaleElementReferenceException, ENI_Exception):
312314
self.wait_for_ready_state_complete()
313315
time.sleep(0.06)
@@ -316,9 +318,9 @@ def update_text(self, selector, text, by=By.CSS_SELECTOR,
316318
try:
317319
element.clear()
318320
except Exception:
319-
pass # Clearing the text field first isn't critical
321+
pass # Clearing the text field first might not be necessary
320322
except Exception:
321-
pass # Clearing the text field first isn't critical
323+
pass # Clearing the text field first might not be necessary
322324
self.__demo_mode_pause_if_active(tiny=True)
323325
pre_action_url = self.driver.current_url
324326
if type(text) is int or type(text) is float:

0 commit comments

Comments
 (0)