You are viewing the documentation for a prerelease version. View Latest

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.

index(), clear(), and cancel() are also available for tests that care about ordering or interruption rather than just content.