diff --git a/src/Support/GuessLocator.php b/src/Support/GuessLocator.php
index b9abb555..673fd89b 100644
--- a/src/Support/GuessLocator.php
+++ b/src/Support/GuessLocator.php
@@ -38,6 +38,16 @@ public function for(string $selector, ?string $value = null): Locator
if (Selector::isDataTest($selector)) {
$id = Selector::escapeForAttributeSelectorOrRegex(str_replace('@', '', $selector), true);
+ if ($value !== null) {
+ $value = sprintf('[value=%s]', Selector::escapeForAttributeSelectorOrRegex($value, true));
+
+ return $this->page->unstrict(
+ fn (): Locator => $this->page->locator(
+ "[data-testid=$id]$value, [data-test=$id]$value",
+ ),
+ );
+ }
+
return $this->page->unstrict(
fn (): Locator => $this->page->locator(
"[data-testid=$id], [data-test=$id]",
diff --git a/tests/Browser/Webpage/AssertRadioTest.php b/tests/Browser/Webpage/AssertRadioTest.php
index 24f026a6..15c798e7 100644
--- a/tests/Browser/Webpage/AssertRadioTest.php
+++ b/tests/Browser/Webpage/AssertRadioTest.php
@@ -36,6 +36,22 @@
$page->assertRadioNotSelected('color', 'red');
})->throws(ExpectationFailedException::class);
+it('may assert radio is selected by data-testid and value', function (): void {
+ Route::get('/', fn (): string => '');
+
+ $page = visit('/');
+
+ $page->assertRadioSelected('@color', 'blue');
+});
+
+it('may assert radio is not selected by data-testid and value', function (): void {
+ Route::get('/', fn (): string => '');
+
+ $page = visit('/');
+
+ $page->assertRadioNotSelected('@color', 'blue');
+});
+
it('may assert all radios in a group are not selected', function (): void {
Route::get('/', fn (): string => '');