<p dir="auto">It's possible to interact with form controls by their <code class="notranslate">&lt;label&gt;</code>, but not to select them.</p>
<p dir="auto">Other elements can also be labelled with <code class="notranslate">aria-label</code>/<code class="notranslate">aria-labelledby</code>, such as:</p>
<div class="highlight highlight-text-html-basic notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;h2 id=&quot;list-of-things&quot;&gt;A list of things&lt;/h2&gt;
&lt;ul aria-labelledby=&quot;list-of-things&quot;&gt;
  &lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;"><pre class="notranslate"><span class="pl-kos">&lt;</span><span class="pl-ent">h2</span> <span class="pl-c1">id</span>="<span class="pl-s">list-of-things</span>"<span class="pl-kos">&gt;</span>A list of things<span class="pl-kos">&lt;/</span><span class="pl-ent">h2</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;</span><span class="pl-ent">ul</span> <span class="pl-c1">aria-labelledby</span>="<span class="pl-s">list-of-things</span>"<span class="pl-kos">&gt;</span>
  <span class="pl-kos">&lt;</span><span class="pl-ent">li</span><span class="pl-kos">&gt;</span>...<span class="pl-kos">&lt;/</span><span class="pl-ent">li</span><span class="pl-kos">&gt;</span>
<span class="pl-kos">&lt;/</span><span class="pl-ent">ul</span><span class="pl-kos">&gt;</span></pre></div>
<p dir="auto">but there isn't a way (that I'm aware of) to select an element with the label 'A list of things'.</p>
<p dir="auto">The selector documentation gives the example</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="await page.locator('[aria-label=&quot;Sign in&quot;]').click();"><pre class="notranslate"><span class="pl-k">await</span> <span class="pl-s1">page</span><span class="pl-kos">.</span><span class="pl-en">locator</span><span class="pl-kos">(</span><span class="pl-s">'[aria-label="Sign in"]'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">click</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">which is enough when using <code class="notranslate">[aria-label]</code>.</p>
<h2 dir="auto">Suggestions</h2>
<ul dir="auto">
<li>A <code class="notranslate">label</code> selector that works similar to <code class="notranslate">text</code> (<code class="notranslate">'label=A list of things'</code>, <code class="notranslate">'label="A list of things"'</code>, <code class="notranslate">'label=/A\\s*list\\s*of\\s*things/i'</code>) that works on <code class="notranslate">aria-label</code>, <code class="notranslate">aria-labelledby</code> and <code class="notranslate">&lt;label&gt;</code>.</li>
<li>Recognise the <code class="notranslate">aria-labelledby</code> attribute and fill in <code class="notranslate">aria-label</code> with its text content. (Don't feel great, but means not extra selector.)</li>
</ul>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: 1.32.1</li>
<li>Operating System: Windows 11 (WSL2 Ubuntu 22.04.2 LTS)</li>
<li>Browser:  WebKit</li>
</ul>
<h3 dir="auto">Source code</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I provided exact source code that allows reproducing the issue locally.</li>
</ul>




<p dir="auto"><strong>Link to the GitHub repository with the repro</strong></p>
<p dir="auto"><a href="https://github.com/ltsuda/webkit-salt-file">https://github.com/ltsuda/webkit-salt-file</a></p>
<p dir="auto"><strong>Steps</strong></p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="git clone https://github.com/ltsuda/webkit-salt-file.git
npm ci
npx playwright install
npx playwright test --project 'webkit'"><pre class="notranslate">git clone https://github.com/ltsuda/webkit-salt-file.git
npm ci
npx playwright install
npx playwright <span class="pl-c1">test</span> --project <span class="pl-s"><span class="pl-pds">'</span>webkit<span class="pl-pds">'</span></span></pre></div>
<p dir="auto">The only thing related to this is from:<br>
<a href="https://stackoverflow.com/questions/75808396/playwright-webkit-creates-a-salt-file-in-the-root-of-directory" rel="nofollow">https://stackoverflow.com/questions/75808396/playwright-webkit-creates-a-salt-file-in-the-root-of-directory</a></p>
<p dir="auto">Also, tried without the <code class="notranslate">webServer</code> to use an external URL but issue didn't reproduce</p>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto"><code class="notranslate">salt</code> file not created</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto"><code class="notranslate">salt</code> file is created with 4-5 binary characters</p>