# Radio Button not selected with Click

**URL:** <https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371>\
**Category:** Browser\
**Created:** [19 October 2023 05:18 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371 "2023-10-19T05:18:22Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![kalle.mujunen](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@kalle.mujunen](https://forum.robotframework.org/u/kalle.mujunen)\
**Post date:** [19 October 2023 05:18 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371/1 "2023-10-19T05:18:22Z")

</div>

Hi!

I am using Browser Library with Robot Framework in my work. I am trying to create a test script for document, which is using Radio Button selection. Used Keyword is below:

Keyword for Radio Button Action  
Wait For Elements State xpath=//_[starts-with(@value,“Value of Radio Button”)] visible timeout=2s  
Click xpath=//_[starts-with(@value,“Value of Radio Button”)] delay=100ms

I have tried a few tricks already, but it seems selecting this Radio Button is not successful. Any suggestions, how could I solve it?

Thank you!

---

<div class="post-metadata">

**Author:** ![kalle.mujunen](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@kalle.mujunen](https://forum.robotframework.org/u/kalle.mujunen)\
**Post date:** [20 October 2023 05:06 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371/3 "2023-10-20T05:06:43Z")

</div>

One more thing. This is screenshot from console. Blue painted is Radio Button text.  
 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/a/af296b1e375598f8c44099f390b8e3d6618fff06.png)

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [20 October 2023 05:53 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371/4 "2023-10-20T05:53:39Z")

</div>

Hi Kalle,

do you get an error or warning in your log? what was the message?

Something to try:

```python
Click xpath=//[starts-with(@value,“Value of Radio Button”)]/..

```

This will click the \<span\> above the \<input\> which might be blocking the \<input\> from receiving the click

You might need to even click the \<label\> or even the \<label\>'s parent, depending on your site’s HTML and CSS

Hope that helps,

Dave.

---

<div class="post-metadata">

**Author:** ![kalle.mujunen](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@kalle.mujunen](https://forum.robotframework.org/u/kalle.mujunen)\
**Post date:** [20 October 2023 05:59 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371/5 "2023-10-20T05:59:28Z")

</div>

Hi

Thanks for reply. I got this kind of warning:

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/a/ae801d83761bde83a808c20080e97858842c836b.png)

I have also tried to click label, but so far I haven’t find out solution, which could work.

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [20 October 2023 06:15 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371/6 "2023-10-20T06:15:37Z")

</div>

Hi Kalle,

As I suspected the message in the log is telling you there are other elements covering the element you are trying to click.

On the first try it was a `<span class="mat-radio-container">`, on the second try it was a \<div\> with a class of footer

You might need to scroll the page so the radio button is not covered before trying to click it. It’s also a good idea to let the page finish loading before interacting with it to prevent these types of issues.

Dave.

---

<div class="post-metadata">

**Author:** ![kalle.mujunen](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@kalle.mujunen](https://forum.robotframework.org/u/kalle.mujunen)\
**Post date:** [20 October 2023 07:38 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371/7 "2023-10-20T07:38:35Z")

</div>

Hi

Thanks. Your help was valuable. Now it seems to click Radio Button successfully, or so report says. However, the state of the Radio Button is still this:  
 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/4/4d61d7a07ce9ba4635f09b48f63540413aae93c3.png)

It should be this:  
 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/7/749249ba4e123695be7260bd1327986da997fc67.png)

---

<div class="post-metadata">

**Author:** ![Timo](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Timo](https://forum.robotframework.org/u/Timo)\
**Post date:** [20 October 2023 12:02 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371/8 "2023-10-20T12:02:55Z")

</div>

Have you tried Check Checkbox keyword? It should work for radio buttons and as it does not perform click, overlapping elements shouldn’t be a problem. And it does not deselect the radio button if it was already selected.  
Wait For Elements State shouldn’t be needed, because it is in-built in Browser keywords.

---

<div class="post-metadata">

**Author:** ![kalle.mujunen](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@kalle.mujunen](https://forum.robotframework.org/u/kalle.mujunen)\
**Post date:** [23 October 2023 07:14 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371/9 "2023-10-23T07:14:04Z")

</div>

Hi

Thanks for the tip. I tried that. However, I got this kind of error message after that:

```
Error: locator.check: Clicking the checkbox did not change its state

```

=========================== logs ===========================  
waiting for locator(‘xpath=//\*[@id=“mat-radio-3”]/label/span[1]’)  
locator resolved to …  
attempting click action  
waiting for element to be visible, enabled and stable  
element is visible, enabled and stable  
scrolling into view if needed  
done scrolling  
performing click action  
click action done  
waiting for scheduled navigations to finish  
navigations have finished

---

<div class="post-metadata">

**Author:** ![kalle.mujunen](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@kalle.mujunen](https://forum.robotframework.org/u/kalle.mujunen)\
**Post date:** [23 October 2023 09:54 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371/10 "2023-10-23T09:54:43Z")

</div>

I read discussion about Checkbox and I realized there are difficulties with that too. Is it possible, that Radio Button selection in this case is comparable for those issues?

---

<div class="post-metadata">

**Author:** ![Timo](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Timo](https://forum.robotframework.org/u/Timo)\
**Post date:** [26 October 2023 06:39 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371/11 "2023-10-26T06:39:44Z")

</div>

Hi Kalle,  
Have you tried to check (or click) the input tag instead of span?  
I don’t have experience of the Check Checkbox keyword, because in my tests this has worked:  
Click css:input:not(:checked)[type=‘checkbox’]

As a dirty solution: can you click some element above the radio button, navigate to the radio button by tab and press space to select it?

---

<div class="post-metadata">

**Author:** ![kalle.mujunen](https://avatars.discourse-cdn.com/v4/letter/k/3da27b/32.png) [@kalle.mujunen](https://forum.robotframework.org/u/kalle.mujunen)\
**Post date:** [26 October 2023 11:25 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371/12 "2023-10-26T11:25:23Z")

</div>

Thanks for tip. I will test it when we will get the environment in case back for our purposes. I will inform you about the result.

---

<div class="post-metadata">

**Author:** ![Mahesh](https://avatars.discourse-cdn.com/v4/letter/m/9dc877/32.png) [@Mahesh](https://forum.robotframework.org/u/Mahesh)\
**Post date:** [16 November 2023 19:38 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371/13 "2023-11-16T19:38:55Z")

</div>

Try with js path using execute javascript keyword

---

<div class="post-metadata">

**Author:** ![tuijalei](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/tuijalei/32/4861_2.png) [@tuijalei](https://forum.robotframework.org/u/tuijalei)\
**Post date:** [5 August 2025 09:09 UTC](https://forum.robotframework.org/t/radio-button-not-selected-with-click/6371/14 "2025-08-05T09:09:13Z")

</div>

Fur future viewers encountering similar issue: I had trouble selecting a radio button using the standard `Click` keyword as it wouldn’t register the selection. What finally worked for me was:

`Browser.Click With Options xpath=<xpath> force=True`
