nvda.speech
What NVDA asked to say, and waiting for it.
def test_nvda_speaks_when_asked(nvda):
before = nvda.speech.index()
nvda.speech.speak("the quick brown fox")
found = nvda.speech.wait_for("quick brown fox", timeout=20, since=before)
assert "quick brown fox" in found.text
wait_for polls until a speech sequence matching the pattern arrives, since the given index —
it will not pass on a stale sequence spoken before since, and raises on timeout instead of
returning None.
Without since, wait_for snapshots index() at call time and only sees speech produced
afterwards; capture index() before a synchronous action and pass it as since. pattern is a
case-insensitive regex.
| Method | Returns |
|---|---|
|
the current cursor; pass it to |
|
every |
|
every sequence this session ( |
|
the most recent sequence, or |
|
drops captured speech |
|
asks NVDA to speak |
|
cancels current speech |
|
how many times speech was cancelled |
|
returns once NVDA’s event queue has drained |