---
title: "Comment by Ákos Kőműves on \"How to test a select element with React Testing Library\" | Hashnode"
description: "Thanks for sharing this Cathal Mac Donnacha . I didn&#39;t know I could do expect(screen.getByRole( &#x27;option&#x27; , { name: &#x27;Select a country&#x27; })"
url: "https://hashnode.com/posts/how-to-test-a-select-element-with-react-testing-library/615deda08e8734462af5b4a6/comment/6384d1eb9537c92102ec0fc5"
---

[Discussion](https://hashnode.com/posts/how-to-test-a-select-element-with-react-testing-library/615deda08e8734462af5b4a6)

Comment [How to test a select element with React Testing Library](https://hashnode.com/posts/how-to-test-a-select-element-with-react-testing-library/615deda08e8734462af5b4a6)

[Ákos Kőműves](https://hashnode.com/@akoskm)

[Nov 28, 2022](https://hashnode.com/posts/how-to-test-a-select-element-with-react-testing-library/615deda08e8734462af5b4a6/comment/6384d1eb9537c92102ec0fc5)

Thanks for sharing this [Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha).

I didn't know I could do

```
expect(screen.getByRole('option', { name: 'Select a country' }).selected).toBe(true)
```

[Cathal Mac Donnacha](https://hashnode.com/@cathalmacdonnacha)

[Nov 28, 2022](https://hashnode.com/posts/how-to-test-a-select-element-with-react-testing-library/615deda08e8734462af5b4a6/comment/6384d1eb9537c92102ec0fc5#reply-6384d8889537c92102ec108d)

Yea it's a much more reliable way of checking it. Glad you found it useful. 👍
