Commit e94d9f64 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[perf] Improve InputWithSelector login helper

Add timeout before and after setting the focus. Otherwise it's quite likely
that we drop one or two characters when using InputWithSelector.

Bug: 878390
Change-Id: Ib703447425160eb87683143a61e03461af1795b7
Reviewed-on: https://chromium-review.googlesource.com/c/1256984Reviewed-by: default avatarJuan Antonio Navarro Pérez <perezju@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595920}
parent 797569c8
......@@ -54,10 +54,14 @@ def InputWithSelector(action_runner, input_text, input_selector):
possible exceptions.
"""
action_runner.WaitForElement(selector=input_selector)
action_runner.Wait(0.5)
# Focus the requested element first and then enter text using single
# Keyboard events to bypass certain restrictions on websites.
action_runner.ExecuteJavaScript(
'document.querySelector({{selector}}).focus()', selector=input_selector)
# Wait a bit to make sure the focus is properly set, otherwise we'll end up
# losing some characters.
action_runner.Wait(0.5)
action_runner.EnterText(input_text)
def InputForm(action_runner, input_text, input_id, form_id=None):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment